Undefined Symbol BasicLogger_isPriorityEnabled
I'm using Java 1.6 JNI and C++ compiled using g++ 4.4.2 on RHEL 5. Our .so file loads another company's .so file for our required interface
I have two versions of our shared object (.so) file that we load from our Java app. The older one works but the newer one throws an undefined symbol exception. I ran the following command on both .so files and kept the output of each in a separate file:
nm lib<myLIb>.so > out-3 (on the old .so)
nm lib<myLib>.so > out-5 (on the new .so)
using 'vmdiff out-3 out-5' showed that the new file has 2 additional symbols. Here's a sample of the diff:
old .so:
U BasicLogger_configure
U BasicLogger_create
------------------
U BasicLogger_log
.
.
.
-----------------
U _Znst8ios_base4InitCIEv@@GLIBCXX_3.4
new .so:
U BasicLogger_configure
U BasicLogger_create
U BasicLogger_isPriorityEnabled
U BasicLogger_log
.
.
.
U _ZNSolsEPKv@@GLIBCXX_3.4
U _Znst8ios_base4InitCIEv@@GLIBCXX_3.4
The error from the java app when using the new .so: 'undefined symbol: BasicLogger_log' Oddly, this symbol resides just after the new symbol BasicLogger_isPriorityEnabled. The old .so works fine.
The command I'm using for g++ is:
g++ -g -Wl, --no-undefined -L/opt/<otherLibDir>/lib -o lib<myLib>.so myJni.cpp -shared -I/usr/java/jdk1.6.0_29 -I /usr/java/jdk1.6.0_29/linux /usr/java/jdk1.6.0_29/linux-shared -I/opt/<otherCompany's>/include /opt/<otherCompany's>/lib/<otherCompany's>.a
The only thing I can think to do is to use yum to remove gcc and g++ and then use yum to reinstall (thinking that maybe something is incorrectly configured on my machine).
Does anyone have any suggestions on what I might look at to fix this?
Thanks
Last edited by ivspman; 12-20-2012 at 12:49 PM.
|