Can't find a library that's right there
I have a library on my system, yet I'm having trouble accessing it:
$ ls -l /usr/lib/R/bin/libR.so
-rw-r--r-- 1 root root 1638320 Jun 22 05:01 /usr/lib/R/bin/libR.so
Here is my link step, and subsequent failures, even after setting
LD_LIBRARY_PATH:
g++ -o test1 mspathCEntry_test.o Manager_test.o TestManager.o
PathGenerator_test.o TestRecorder.o SimpleRecorder_test.o
TimeStepsGenerator_test.o StateTimeClassifier_test.o Environment_test.o
SuccessorGenerator_test.o Model_test.o ConstrainedCoefficients_test.o
Path_test.o Data_test.o TimeSteps_test.o TimePoint_test.o basic_test.o
../mspath.so -L/usr/lib/debug -lboost_unit_test_framework \
-L/usr/lib/R/bin -lR
./test1 --report_level=detailed
./test1: error while loading shared libraries: libR.so: cannot open
shared object file: No such file or directory
make: *** [runtest] Error 127
My test program is in the build directory; mspath.so is one directory
up, and mspath.so references libR.so.
ross@iron:~/peter/R/mspath/src/test$ ldd test1
../mspath.so => ../mspath.so (0x40018000)
libboost_unit_test_framework-gcc-mt-1_31.so.1.31.0 =>
/usr/lib/libboost_unit_test_framework-gcc-mt-1_31.so.1.31.0 (0x40047000)
libR.so => not found
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40068000)
libm.so.6 => /lib/libm.so.6 (0x40122000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x40144000)
libc.so.6 => /lib/libc.so.6 (0x4014d000)
libR.so => not found
librt.so.1 => /lib/librt.so.1 (0x40280000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40293000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
ross@iron:~/peter/R/mspath/src/test$ echo $LD_LIBRARY_PATH
ross@iron:~/peter/R/mspath/src/test$ LD_LIBRARY_PATH=/usr/lib/R/bin
ross@iron:~/peter/R/mspath/src/test$ !ldd
ldd test1
../mspath.so => ../mspath.so (0x40018000)
libboost_unit_test_framework-gcc-mt-1_31.so.1.31.0 =>
/usr/lib/libboost_unit_test_framework-gcc-mt-1_31.so.1.31.0 (0x40047000)
libR.so => not found
etc.
Here's how I made mspath.so:
g++ -I/usr/lib/R/include -mieee-fp -I . -fPIC -g -O2 -c mspath.cc -o
mspath.o
g++ -shared -o mspath.so ConstrainedCoefficients.o Data.o Manager.o
Model.o Path.o PathGenerator.o SimpleRecorder.o StateTimeClassifier.o
SuccessorGenerator.o TestManager.o TestRecorder.o TimeStepsGenerator.o
mspath.o -L/usr/lib/R/bin -lR
The .o files in my test program are compiled like
g++ -O2 -I .. -c -o Path_test.o Path_test.cc
They don't, for example, have -fPIC, but they aren't destined for a
shared library. Still, I wonder if the "not found" is a misleading
error message for "incompatible formats".
I'd appreciate any ideas about what's going on. If you could cc me that
would be great, as I'm not subscribed.
I hope this isn't too off-topic; it seemed to make more sense here than
debian-user (it's a Debian system).
Thanks.
--
Ross Boylan wk: (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4 ross@biostat.ucsf.edu
Dept of Epidemiology and Biostatistics fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840 hm: (415) 550-1062
Reply to: