[Rd] Large size shared library

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Nov 22 14:13:49 CET 2014


On 22/11/2014 08:34, Chen, Han wrote:
> 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!

7MB is not 'a lot of space'.  There are CRAN packages which compiled 
with -g take ca 80MB.

> 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]]

Please do follow the posting guide and not send HTML.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK



More information about the R-devel mailing list