Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205491

Compacting Shared Libraries in R package

$
0
0

My package .so file is above 3 MB (up to 10 MB) depending of the compiler and the system. This generates a NOTE with R CMD check in my package for years. My package does not contain so much code so I eventually searched to reduce the size and I found this excellent post by Dirk Eddelbuettel.

Following the advice I added SHLIB_CXX11LDFLAGS = -Wl,-S -shared in my .R/Makevars and my library size dropped from 10.4 MB to 580 KB!! For the first time I have 0 ERRORS, 0 WARNINGS and 0 NOTES. Yeah!

However this is only a local solution. At the end of the post the following is suggested for src/Makevars

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

.phony: strippedLib

But it is mentioned that:

And this scheme may even pass muster with CRAN, but I have not yet tried.

My questions are the following:

  • The post is from Aug 2017. Does somebody knows if it passes CRAN check?
  • This is a GNU/Linux (maybe macOS) solution. Is there a cross-platform option?

Viewing all articles
Browse latest Browse all 205491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>