Skip to content

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

5 messages · Christopher Lalansingh, Dirk Eddelbuettel, Thibault Vatter

#
Hello all,


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.


Thanks,


Christopher Lalansingh
Software Engineer

Direct: 647-258-4313


Ontario Institute for Cancer Research
MaRS Centre, West Tower
661 University Ave, Suite 510
Toronto, Ontario, Canada M5G 0A3



This message and any attachments may contain confidentia...{{dropped:12}}
#
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
#
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:

            

  
  
#
On 4 January 2018 at 00:27, Thibault Vatter wrote:
| 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

Yes, this is good. Someone (you?) had pointed this out to me before.

Did you add this to your actual released and on-CRAN package?

Dirk
#
No, we're preparing a new release which we'll submit in the next few days.
On Thu, Jan 4, 2018 at 7:06 PM, Dirk Eddelbuettel <edd at debian.org> wrote: