[Rcpp-devel] Large size of libs directory on some systems
Dirk Eddelbuettel
edd at debian.org
Mon Nov 28 21:39:26 CET 2016
On 28 November 2016 at 21:13, Dean Bodenham wrote:
| Dear Dirk,
|
| Thank you for your last email - your suggestion worked perfectly!
|
| To be clear (for others), creating a ~/.R/Makevars file containing:
|
| DYLIB_LDFLAGS = -shared -fopenmp# $(CFLAGS) $(CPICFLAGS)
| SHLIB_CXXLDFLAGS = -shared
| SHLIB_CXX1XLDFLAGS = -shared
| SHLIB_FCLDFLAGS = -shared
| SHLIB_LDFLAGS = -shared# $(CFLAGS) $(CPICFLAGS)
| PKG_LIBS= -Wl,-S
|
| (where the first five lines are from /etc/R/Makeconf) resulted in a much
| smaller ffstream.so for me on Ubuntu 16.04.
Not quite what I meant. You can't "hog" PKG_LIBS as some package use it (eg
for RcppArmadillo). Try
DYLIB_LDFLAGS = -Wl,-S -shared -fopenmp# $(CFLAGS) $(CPICFLAGS)
SHLIB_CXXLDFLAGS = -Wl,-S -shared
SHLIB_CXX1XLDFLAGS = -Wl,-S -shared
SHLIB_FCLDFLAGS = -Wl,-S -shared
SHLIB_LDFLAGS = -Wl,-S -shared# $(CFLAGS) $(CPICFLAGS)
instead.
Dirk
|
| I have just started playing around with Dan's r-stripper, but have not quite
| got it working yet.
|
| Dean
|
| On Sat, Nov 26, 2016 at 4:59 PM, Dan Dillon <dcdillon at gmail.com> wrote:
|
| Dean,
|
| I too have been concerned about this and working on a solution for some
| time. I just formalized my work and put it in a repo at https://github.com
| /dcdillon/r-stripper. Basically this script adds the appropriate commands
| to the PKG_LIBS variable to cause the linker to strip the debugging symbols
| from the shared library that is created.
|
| Feel free to try it out. Right now it only knows how to do this for gcc,
| g++, clang, and clang++ but adding others is no problem as long as I know
| how to figure out which linker it is and know the option to pass to the
| linker to achieve "stripping".
|
| Thanks,
|
| Dan
|
| On Sat, Nov 26, 2016 at 7:55 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
|
|
| On 26 November 2016 at 12:22, Dean Bodenham wrote:
| | Dear Dirk,
| |
| | Thank you very much for your detailed replies!
| |
| | The Ubuntu system does indeed seem to be using the -g flag. I did try
| a local
| | compile/installation with the ~/.R/Makevars file you suggested, but
| couldn't
| | quite get it to work - I get warnings "linking not done" for the .o
| files, and
| | then an error that the "ffstream.so" file is not found.
|
| Well "it worked me for" but a better approach entirely outside of your
| package may be to take
|
| edd at max:~$ grep shared /etc/R/Makeconf
| DYLIB_LDFLAGS = -shared -fopenmp# $(CFLAGS) $(CPICFLAGS)
| SHLIB_CXXLDFLAGS = -shared
| SHLIB_CXX1XLDFLAGS = -shared
| SHLIB_FCLDFLAGS = -shared
| SHLIB_LDFLAGS = -shared# $(CFLAGS) $(CPICFLAGS)
| edd at max:~$
|
| and add them to ~/.R/Makevars as
|
| DYLIB_LDFLAGS = -shared -fopenmp# $(CFLAGS) $(CPICFLAGS)
| SHLIB_CXXLDFLAGS = -shared
| SHLIB_CXX1XLDFLAGS = -shared
| SHLIB_FCLDFLAGS = -shared
| SHLIB_LDFLAGS = -shared# $(CFLAGS) $(CPICFLAGS)
|
| When I do that without/with the change I get
|
| edd at max:/tmp/ffstream$ ls -lh ffstream*/src/ffstream.so
| -rwxrwxr-x 1 edd edd 9.0M Nov 26 07:52 ffstream.orig/src/ffstream.so
| -rwxrwxr-x 1 edd edd 734K Nov 26 07:52 ffstream/src/ffstream.so
| edd at max:/tmp/ffstream$
|
| I think it is an issue worth raising with on r-devel and I may do so.
|
| Dirk
|
| --
| http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
|
|
|
|
--
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel
mailing list