Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could mention stripping #1

Open
eddelbuettel opened this issue Jul 2, 2020 · 0 comments
Open

Could mention stripping #1

eddelbuettel opened this issue Jul 2, 2020 · 0 comments

Comments

@eddelbuettel
Copy link

The added C++ 'glue' certainly adds code, so we cannot expect 92kb == 17kb. But there were some explorations I made into stripping (all on my blog, likely under the r4/ series). In short, CRAN won't let us put (aggressive) stripping in src/Makevars but you can always add it locally. My ~/.R/Makevars has had this for a while (years?)

STRIP=-Wl,-S
SHLIB_CXXLDFLAGS = $(STRIP) -shared
SHLIB_CXX11LDFLAGS = $(STRIP) -shared
SHLIB_CXX14LDFLAGS = $(STRIP) -shared
SHLIB_CXX17LDFLAGS = $(STRIP) -shared
SHLIB_FCLDFLAGS = $(STRIP) -shared
SHLIB_LDFLAGS = $(STRIP) -shared

and I then see 67kb instead of 92kb.

edd@rob:~/git/simplercpp(master)$ install.r
* installing *source* package found in current working directory ...
* installing *source* package ‘simplercpp’ ...
** using staged installation
** libs
ccache g++ -I"/usr/share/R/include" -DNDEBUG  -I'/usr/local/lib/R/site-library/Rcpp/include'    -fpic  -g -O3 -Wall -pipe -pedantic  -c RcppExports.cpp -o RcppExports.o
ccache g++ -I"/usr/share/R/include" -DNDEBUG  -I'/usr/local/lib/R/site-library/Rcpp/include'    -fpic  -g -O3 -Wall -pipe -pedantic  -c add.cpp -o add.o
ccache g++ -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o simplercpp.so RcppExports.o add.o -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-simplercpp/00new/simplercpp/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (simplercpp)
edd@rob:~/git/simplercpp(master)$ ls -hl /usr/local/lib/R/site-library/simplercpp/libs/
total 68K
-rwxrwxr-x 1 edd staff 67K Jul  2 08:40 simplercpp.so
edd@rob:~/git/simplercpp(master)$ 

Might be worth mentioning. Of course, it also likely reduces the C solution size...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant