[Rd] Large size shared library

Chen, Han hanchen at hsph.harvard.edu
Sat Nov 22 09:34:19 CET 2014


Dear all,

I have an R package that I plan to submit to CRAN in the near future, but it gave me a note when I ran "R CMD check --as-cran" saying that my libs directory is 7.0Mb. I wrote some functions in C++ and my source code included several low-level C++ libraries as header files. When I compiled manually using g++ without the -g flag, my shared library (.so) was about 400Kb; but when I compiled with the -g flag, it was about 7.0Mb... I am assuming there was a lot of debugging information created when I turned on -g, possibly because the compiler had to look for a lot of classes and functions in low-level C++ libraries, but I am worried that the package would fail CRAN check due to the large size .so file created (it seems R has -g flag on by default when compiling C/C++ code according to ${R_HOME}/etc/Makeconf). Does anyone have any suggestions on how I could possibly make my shared library file smaller? Even though I can compile it manually without the -g flag, general users will use R default to install the package and it could take a lot of space. Thanks in advance!

Best,
Han

-----
Han Chen, Ph.D.
Postdoctoral Research Fellow
Department of Biostatistics
Harvard School of Public Health
http://www.hsph.harvard.edu/han-chen/


	[[alternative HTML version deleted]]



More information about the R-devel mailing list