[Rcpp-devel] Rcpp build trouble with strings

Dirk Eddelbuettel edd at debian.org
Thu Aug 22 01:29:11 CEST 2013


On 20 August 2013 at 11:39, Wush Wu wrote:
| Thanks for you correction, Dirk.
| 
| It seems that if I don't care about portability, I could add the absolutely
| path of the .so files into OBJECTS in Makevars.
| 
| For example:
| 
| ```
| ## Use the R_HOME indirection to support installations of multiple R version
| PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` 
| 
| OBJECTS = RcppExports.o rcpp_hello_world.o /home/wush/Test/TestLinking/inst/
| linkHello.so
| ```
| 
| Is that correct?

It may build, but you still have the _same issue_ that the dynamic linker
will not know where linkHello.so is.

You can overcome this by creating proper libraries.

Or you can overcome this by creating a package-local static library and link
to that.  Directly including all your .o files in the link is
equivalent. This is easier, and some CRAN packages do that.  

Dirk
 
| Thanks, 
| 
| Wush
| 
| 2013/8/20 Dirk Eddelbuettel <edd at debian.org>
| 
| 
|     On 20 August 2013 at 08:34, Wush Wu wrote:
|     | Maybe you need to set some flag in NAMESPACES to ask the package to load
|     | required libraries.
| 
|     No, not at all.
| 
|     The system linker still needs to find it. Example from my system:
| 
|     edd at max:~$ ldd /usr/local/lib/R/site-library/RcppGSL/libs/RcppGSL.so
|             linux-vdso.so.1 =>  (0x00007ffff97fe000)
|             libgsl.so.0 => /usr/lib/libgsl.so.0 (0x00007f77d6211000)
|             libgslcblas.so.0 => /usr/lib/libgslcblas.so.0
|     (0x00007f77d5fc9000)
|             libRcpp.so => /usr/local/lib/R/site-library/Rcpp/lib/libRcpp.so
|     (0x00007f77d5d4a000)
|             libR.so => /usr/lib/libR.so (0x00007f77d5848000)
|             libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
|     (0x00007f77d5545000)
|             libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6
|     (0x00007f77d523f000)
|             libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1
|     (0x00007f77d5029000)
|             libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
|     (0x00007f77d4c61000)
|             libblas.so.3 => /usr/lib/libblas.so.3 (0x00007f77d328f000)
|             libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6
|     (0x00007f77d304d000)
|             libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3
|     (0x00007f77d2e0e000)
|             liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5
|     (0x00007f77d2beb000)
|             libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0
|     (0x00007f77d29db000)
|             libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1
|     (0x00007f77d27c4000)
|             librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1
|     (0x00007f77d25bb000)
|             libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2
|     (0x00007f77d23b7000)
|             libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1
|     (0x00007f77d21a8000)
|             libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
|     (0x00007f77d1f8a000)
|             /lib64/ld-linux-x86-64.so.2 (0x00007f77d689f000)
|             libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5
|     (0x00007f77d1d62000)
|     edd at max:~$
| 
|     All libraries resolve cleanly -- and I can of course load the package.
| 
|     Dirk
| 
|     --
|     Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
| 
| 

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list