Reputation: 21
I'm using a third party shared library (libsw_api.so) on Solaris, which when I try to load, produces the following error:
fatal: relocation error: file libsw_api.so:
symbol _ZNKSt9bad_alloc4whatEv: referenced symbol not found
The program exited with error code 1
When I run ldd on libsw_api.so, all references seem to be fulfilled, specifically the C++ standard library which points to libstdc++.so.6.0.3:
glispa02(fostopr)$ ldd libsw_api.so
...
libstdc++.so.6 => /usr/sfw/lib/libstdc++.so.6
...
glispa02(fostopr)$ ls -l /usr/sfw/lib/libstdc++.so.6
lrwxrwxrwx 1 root root 18 Jun 21 2010 /usr/sfw/lib/libstdc++.so.6 -> libstdc++.so.6.0.3
However that library does not export _ZNKSt9bad_alloc4whatEv,
glispa02(fostopr)$ nm /usr/sfw/lib/libstdc++.so.6 | grep bad_alloc
[7592] | 752340| 64|FUNC |GLOB |0 |2653 |_ZNSt9bad_allocD0Ev
[7324] | 752284| 56|FUNC |GLOB |0 |2652 |_ZNSt9bad_allocD1Ev
[8077] | 752228| 56|FUNC |GLOB |0 |2651 |_ZNSt9bad_allocD2Ev
[7519] | 356736| 76|FUNC |GLOB |0 |473 |_ZSt17__throw_bad_allocv
[7341] | 983588| 12|OBJT |WEAK |0 |3842 |_ZTISt9bad_alloc
[6569] | 777008| 13|OBJT |WEAK |0 |3317 |_ZTSSt9bad_alloc
[7299] | 983568| 20|OBJT |WEAK |0 |3841 |_ZTVSt9bad_alloc
What could be the problem? Wrong version? I'm not really good with C++ on Unix so I'ld appreciate any help.
Could this SPARC32PLUS vs. SPARC mismatch be the cause of the problem?
glispa02(fostopr)$ file libsw_api.so
libsw_api.so: ELF 32-bit MSB dynamic lib SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped
glispa02(fostopr)$ file /usr/sfw/lib/libstdc++.so.6.0.3
/usr/sfw/lib/libstdc++.so.6.0.3: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically linked, not stripped, no debugging information available
My system:
glispa02(fostopr)$ cat /etc/release
Solaris 10 10/09 s10s_u8wos_08a SPARC
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 16 September 2009
glispa02(fostopr)$ uname -a
SunOS glispa02 5.10 Generic_141444-09 sun4u sparc SUNW,SPARC-Enterprise
Upvotes: 2
Views: 3182
Reputation: 645
I encounter the same issue.
The cause is we export the wrong LD_LIBRARY_PATH So that our shared library link to the original gcc's library (3.3) instead of our compiler (gcc 4.4).
Fix the linker problem should solve the issue
Upvotes: 1
Reputation: 94789
If you use pvs on the libstdc++.so.6
file, it will give you a bunch of entries matching: GLIBCXX
, if you don't have an entry matching GLIBCXX_3.4.9
, then the symbol bad_alloc::what
is not in that library i.e. the library is older than the dependent object libsw_api.so
If this is the case then you probably need a newer version of libstdc++ - it would come with a newer version of g++
Upvotes: 1
Reputation: 21
Hi I'm also upgrading these files, I noticed that I should be using the libstdc++.so.6.0.9 file that comes with the distribution rather than the one in /usr/sfw/lib/
Upvotes: 2