Building shared library that uses libstdc++

Lundell, Jens O. JENS.O.LUNDELL@saic.com
Fri Apr 13 10:41:00 GMT 2001


I want to build a shared library that uses the Standard C++ Library using
Solaris 7 and GCC 2.95.3. I would prefer to statically link the Standard C++
library so I don't have to distribute libstdc++.so.2.10.0. I can create a
shared library like this:

g++ -fPIC -shared -o libjens.so source.cpp

and I can statically link the Standard C++ Library to an executable like
this:

g++ -static -o jensexe source.cpp

but when I combine the two I get the following error:

ld: warning: option -d appears more than once, first setting taken
ld: fatal: option -dn and -z[text|textwarn|textoff] are incompatible
ld: fatal: option -dn and -G are incompatible
ld: fatal: Flags processing errors
collect2: ld returned 1 exit status

Do I have to distribute libstdc++.so.2.10.0 together with my shared library?
Is so, what happens if the machine already has a different version of
libstdc++, dll-hell?

-Jens



More information about the Gcc-help mailing list