[R-pkg-devel] Portable method of stripping debug symbols
Hi, We faced a problem when we tried Dirk's solution for our package rvinecopulib: there is a strip binary on OS X but it doesn't work as the linux one. As such, to avoid calling OS X's strip which doesn't work, we use: strippedLib: $(SHLIB) if test -e "/usr/bin/strip" & test -e "/bin/uname" & [[ `uname` == "Linux" ]] ; then /usr/bin/strip --strip-debug $(SHLIB); fi .phony: strippedLib Hope this helps, Thibault
On Wed, Jan 3, 2018 at 11:13 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
Christopher, 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: http://dirk.eddelbuettel.com/blog/2017/08/20#010_stripping_ shared_libraries http://dirk.eddelbuettel.com/blog/2017/08/14#009_compact_shared_libraries 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. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel