[Rcpp-devel] Templates and Debugging Symbols

Dan Dillon dcdillon at gmail.com
Sun Jul 31 17:42:00 CEST 2016


I am writing a package that makes heavy use of templates.  Since all R
packages are compiled with the -g flag (for g++ and clang++ anyhow), this
ends up putting debugging symbols in the resulting library (.so).  The
problem is, that the size of these symbols bloats the shared library to a
ridiculous extent (13.0MB with, 54K without).

I am looking for a portable way to suppress the creation of debugging
symbols within the libraries.  For gcc/clang it is simple: add -Wl,-S to
your PKG_LIBS variable, but this is not portable.  Furthermore, since my
package is really just a set of headers to be used within Rcpp, any user of
my package would need to be able to easily specify to strip debugging
symbols in any file that includes my headers.

My thoughts are these:

1) if a portable way of making sure debugging symbols are stripped from the
shared libraries is available, turn it into an Rcpp plugin (e.g. //
[[Rcpp::plugins(strip)]]
2) conceive of a way to do it portably and expose it.

I'm looking for any advice or help with this issue.

Thanks,

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160731/6ea6d092/attachment.html>


More information about the Rcpp-devel mailing list