Heinrich Heine
Heinrich Heine

Reputation: 303

compiling against libstdc++.so.5 is not finding symbols @GLIBCPP_3.2

I am building an application which makes use of a third party library which requires libstdc++.so.5. Until recently I was compiling my application with libstdc++.so.6 which worked fine, however it had some portability issues.

Therefore I decided installing g++ version 3.3.4 in order to be capable of compiling my application with libstdc++.so.5. However now I cannot compile my application at all. Neither with my old g++ nor with the 3.3.4 Version of it... Building the application reports the following error message:

/opt/ExPansion/lib/libexpansion.so: undefined reference to `std::basic_istream<char, std::char_traits<char> >::basic_istream(std::basic_streambuf<char, std::char_traits<char> >*)@GLIBCPP_3.2'

EDIT: Interesting might also be the output of the following commands:

$ strings /usr/lib/libstdc++.so.5 | grep 'LIB'    
GLIBCPP_3.2
GLIBCPP_3.2.1
GLIBCPP_3.2.2
GLIBCPP_3.2.3
GLIBCPP_3.2.4
GLIBC_2.0
GLIBC_2.3
GLIBC_2.1.3
GLIBC_2.1
GLIBC_2.2
GLIBCPP_FORCE_NEW

The only thing that makes me wonder is the following:

$ nm /usr/lib/libstdc++.so.5
nm: /usr/lib/libstdc++.so.5: no symbols

Is that "normal"? Is it possible that my lib is not containing the needed symbols? I downloaded this lib through:

yum install compat-libstdc++-33

..so it shouldn't be causing any problems..

From my understanding @GLIBCPP_3.2 is provided by my libstdc++.so.5. So what could be going wrong here?

Upvotes: 1

Views: 1130

Answers (1)

Heinrich Heine
Heinrich Heine

Reputation: 303

I have no idea what causes my linker not finding the lib on its own... The following question helped me however find a "workaround" to my problem: how to force linker to use shared library instead of static library?

Simply forcing my linker to link against the library helped..

gcc -o app app.o {other libs} /usr/lib/libstdc++.so.5

Upvotes: 2

Related Questions