<div dir="ltr">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).<div><br></div><div>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.</div><div><br></div><div>My thoughts are these:</div><div><br></div><div>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)]]</div><div>2) conceive of a way to do it portably and expose it.</div><div><br></div><div>I'm looking for any advice or help with this issue.</div><div><br></div><div>Thanks,</div><div><br></div><div>Dan</div></div>