[R] dyn.load()

NMBahoshy@aol.com NMBahoshy at aol.com
Tue Oct 22 10:17:40 CEST 2002

Dear R-help,

I am trying to use routines written in C and Embedded SQL on Sybase in R using dyn.load().

I compiled a couple of test functions into a .so file which I tried to load with R's dynl.load().  This is what happened:

> dyn.load("libRClib.so")
Error in dyn.load(x, as.logical(local), as.logical(now)) : 
        unable to load shared library "/home/develop/bahomar/tmp/libRClib.so":
  ld.so.1: /home/develop/bahomar/R/lib/R/bin/R.bin: fatal: relocation error: file /opt/sybase/embeddedsql/lib/libct.so: symbol comn_free: referenced symbol not found

As far as I can see there are no unsatisfied symbols. In particular, the symbol comn_free is defined:

> ldd libRClib.so
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libct.so =>      /opt/sybase/embeddedsql/lib/libct.so
        libcs.so =>      /opt/sybase/embeddedsql/lib/libcs.so
        libtcl.so =>     /opt/sybase/embeddedsql/lib/libtcl.so
        libcomn.so =>    /opt/sybase/embeddedsql/lib/libcomn.so
        libintl.so =>    /opt/sybase/embeddedsql/lib/libintl.so
        libnsl.so.1 =>   /usr/lib/libnsl.so.1
        libm.so.1 =>     /usr/lib/libm.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libmp.so.2 =>    /usr/lib/libmp.so.2

> nm /opt/sybase/embeddedsql/lib/libct.so | grep comn_free
[1719]  |         0|       0|NOTY |GLOB |0    |UNDEF  |comn_free


> nm /opt/sybase/embeddedsql/lib/libintl.so | grep comn_free
[167]   |      5624|      12|FUNC |GLOB |0    |7      |comn_free


I am running R:

> R.Version()
[1] "sparc-sun-solaris2.8"

[1] "sparc"

[1] "solaris2.8"

[1] "sparc, solaris2.8"

[1] ""

[1] "1"

[1] "5.1"

[1] "2002"

[1] "06"

[1] "17"

[1] "R"

on UNIX:

> uname -a 
SunOS amtss014 5.8 Generic_108528-01 sun4u sparc SUNW,Ultra-Enterprise

I compiled the shared library as follows:

cc -o libRClib.so -G RCtest.c  \
-I${SYBASE}/embeddedsql/include \
-L${SYBASE}/embeddedsql/lib -L${FIRAS_LIB} \
-ldl -lct -lcs -ltcl -lcomn -lintl -lnsl \
-lmm_infc -lmm_fc -lm

I tried different orderings for the included libraries; to no avail.

I also used the shared library from a test programme. It compile and ran correctly.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list