[Rcpp-devel] linking Rcpp with external GSL library

Dirk Eddelbuettel edd at debian.org
Mon Jan 13 17:30:10 CET 2014

On 13 January 2014 at 10:19, Dirk Eddelbuettel wrote:
| Florian,
| On 13 January 2014 at 15:48, Florian Oswald wrote:
| | sorry for crossposting this on stackoverflow, but I'm stuck. 
| In the future, pick either SO or here. I'd post here.
| | I need some help with a linker error I get during installation of an Rcpp
| | package on a linux system where I don't have admin rights. In a nutshell, I get
| | this error:
| | 
| |     relocation R_X86_64_32 against `.rodata' can not be used when making a
| |     shared object; recompile with -fPIC
| | 
| | Well, I did that (recompile with -fPIC) but to no avail. Please have a look
| | here for many more details:
| | 
| | http://stackoverflow.com/questions/21094740/
| | linking-rcpp-to-interp2d-gsl-type-library
| As far as I can tell, Kevin Ushey's comment (made seconds ago) is spot
| on. Your problem may not be with your compile your Rcpp code but rather with
| the way the GSL was built on that system -- you need a dynamic library.

Looking more carefully, it seems that your use of libinterp2d may be the
issue.  It is a static library, and that may be your problem. Easiest fix is
to copy its code into your package. Higher-end solution would be to make a
shared library out of libinterp2d but you'd also have to distribute that for
use by others.


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

More information about the Rcpp-devel mailing list