[R-pkg-devel] Reducing installed package size with --strip-debug

Dirk Eddelbuettel edd at debian.org
Tue Oct 31 15:24:39 CET 2017


On 31 October 2017 at 15:02, Ege Rubak wrote:
| Based on Dirk's blog post [1] about stripping debug information from the 
| shared object of my package `s2` I reduced the shared object file size 
| from 7 to 0.7 MB and get rid of a NOTE about the installed package size 
| (on my local Linux machine).
| 
| Dirk suggests that one could conditionally do this in the Makevars file 
| if the strip tool is available (typically the case on Linux). Does 
| anybody know what CRAN's take is on this?

The "BDR Doctrine" still stands: no non-portable code in src/Makevars.

So the best I found (as a "live test") was this in RcppClassic (and I indent
what is one long line)

     @if test -e "/usr/bin/strip" & \
         test -e "/bin/uname" & \
         [[ `uname` == "Linux" ]]; then \
         /usr/bin/strip --strip-unneeded $(USERLIB); \
     fi

But but but ... this is in a package which already has an expanded
src/Makevars.  For the simple default one ... I have found nothing better
than a _purely local_ settings in ~/.R/Makevars:

  SHLIB_CXXLDFLAGS = -Wl,-S -shared
  SHLIB_CXX11LDFLAGS = -Wl,-S -shared
  SHLIB_CXX14LDFLAGS = -Wl,-S -shared
  SHLIB_FCLDFLAGS = -Wl,-S -shared
  SHLIB_LDFLAGS = -Wl,-S -shared

as described in the first follow-up to the link you quoted:

   http://dirk.eddelbuettel.com/blog/2017/08/14#009_compact_shared_libraries

It is somewhat sad that we cannot portably set this for packages (at least
not as far as I know), and equally sad that we cannot augment the setting in
$(RHOME)/etc/Makeconf from inside a running R session.

Also see the second follow-up to the link you posted; the file size changes
are nothing short of staggering.

  http://dirk.eddelbuettel.com/blog/2017/08/20#010_stripping_shared_libraries

Dirk   

| 
| Cheers,
| Ege
| 
| [1]: 
| http://dirk.eddelbuettel.com/blog/2017/08/14/#009_compact_shared_libraries
| 
| -- 
| Ege Rubak, Associate Professor,
| Department of Mathematical Sciences, Aalborg University
| Skjernvej 4A, 9220 Aalborg East, Denmark
| Phone: (+45)99408861
| Mobile: (+45)30230252
| Email: rubak at math.aau.dk
| 
| ______________________________________________
| R-package-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-package-devel

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



More information about the R-package-devel mailing list