[R-pkg-devel] Portable method of stripping debug symbols

Dirk Eddelbuettel edd at debian.org
Wed Jan 3 23:13:48 CET 2018


On 3 January 2018 at 21:59, Christopher Lalansingh wrote:
| I'm running into troubles with the total size of my package and I've found that when using Rcpp, one can reduce the size of shared objects by stripping out debug symbols by including `-Wl,-S' in PKG_LIBS. Unfortunately this is not portable with Solaris, and using ifeq in my Makevars file to check for SunOS isn't portable either.
| I came across an Issue on github (https://github.com/RcppCore/Rcpp/issues/522) which addresses possible ways to do this portably, but I can't find reference to // [[Rcpp::plugins(strip)]] in any other documentation. If anyone has run into this before and has any suggestions it would be much appreciated.

I have two writeups on this in my r^4 series:


The earlier one has this snippet you can add to src/Makevars, and you could
even do this conditionally (ie do it on Linux, don't do it on Solaris, or the
other way, or ...)

  strippedLib: $(SHLIB)
          if test -e "/usr/bin/strip"; then /usr/bin/strip --strip-debug $(SHLIB); fi

  .phony: strippedLib

This will strip if and only if there is a strip binary. May work for yuo.


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

More information about the R-package-devel mailing list