|
Help needed for linking nested dynamic library: msg#00243gcc.help
Hi, I got a problem to call a dynamic library if this dynamic library itself also needs another dynamic library: 1) Let's say we uses ACE/TAO libraries: libACE.so, this file is under /usr/local/ACE+TAO/ace 2) My program, test1.cpp will use the CORBA functions at libACE.so, so I make the file as following: export LD_LIBRARY_PATH=/usr/local/ACE+TAO/ace g++ -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT -DACE_HAS_AIO_CALLS -shared -fPIC -O3 -W -Wall -Wpointer-arith -pipe -Wno-uninitialized -march=i686 -I/usr/local/ACE+TAO/ace -o test1.o -c test1.cpp ar rsuv libcppapi.a test1.o 3) Now, I need to build another dynamic library which is a JNI library and will call the function at test1.cpp: g++ -o libjava.so -z text -shared -lcppapi xxx.o 4) We have a Java program (test.java), it loads libjava.so and can call ACE/TAO functions without any problem at the same machine. 5) Now, I moved the program to another machine, which installs the ACE/TAO at different location (/usr/local/ACE_wrappers), I set the LD_LIBRARY_PATH to the proper directories and run it again, but this time I hit the following error: Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/libjava.so: /usr/local/ACE+TAO/ace/libACE.so: cannot open shared object file: No such file or directory at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1473) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1397) at java.lang.Runtime.loadLibrary0(Runtime.java:788) at java.lang.System.loadLibrary(System.java:832) It seems the path is hard coded at the library, not really looking for LD_LIBRARY_PATH. Much appreciated if you could help to solve the problem, i.e. how to make the files properly so that it can search the library dynamically. Thanks. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: X86 Built-in Functions: 00243, Kimmo Fredriksson |
|---|---|
| Next by Date: | Re: FILE Pointer: 00243, Eljay Love-Jensen |
| Previous by Thread: | Problems when building gcc 3.2or 3.3 as cross compiler for powerpc-linuxi: 00243, Richard Sewards |
| Next by Thread: | cannot make gcc-3.3: 00243, Bart Pit |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |