[R] problems with dynamic objects on solaris
Ott Toomet
otoomet at econ.dk
Fri Nov 25 18:40:14 CET 2005
Dear R people,
I am working on a solaris 9 workstation with very restrictive access
policy. It means I have still to use R 1.7.1 and gcc 2.95.
The problems is following: I have written a small function in c++ using
boost library and I want to dyn.load the resulting .so file into R.
Compilation works fine:
/akf/705769/zpu5769/proge/R$ R CMD SHLIB pcw.cc
g++ -I/opt2/R/lib/R/include -I/usr/local/include -fPIC -g -O2 -c pcw.cc -o pcw.o
g++ -G -L/usr/local/lib -o pcw.so pcw.o
/akf/705769/zpu5769/proge/R$
Note the resulting .so file is huge (it is only about 25kB on my
modern linux box):
/akf/705769/zpu5769/proge/R$ ll
total 6134
-rw-r-----+ 1 zpu5769 705769 3151 nov 25 17:24 pcw.cc
-rw-r-----+ 1 zpu5769 705769 3054 nov 18 15:12 pcw.cc~
-rw----rw-+ 1 zpu5769 705769 810492 nov 25 18:00 pcw.o
-rwxrwx---+ 1 zpu5769 705769 1637112 nov 25 18:00 pcw.so
However, I cannot load the object:
> dyn.load("/akf/705769/zpu5769/proge/R/pcw.so")
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library "/akf/705769/zpu5769/proge/R/pcw.so":
ld.so.1: /opt2/R/lib/R/bin/R.bin: fatal: relocation error: file /akf/705769/zpu5769/proge/R/pcw.so: symbol Rf_isReal__FP7SEXPREC: referenced symbol not found
Any ideas? It works on my linux box (R 2.2.0, gcc 3.3.5). Several
functions I have written before, in C (and without boost), are
working.
Thanks in advance,
Ott
More information about the R-help
mailing list