This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Linking libstdc++.a into a shared library.
- From: Stephen M. Webb <stephenw at cryptocard dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Fri, 13 Dec 2002 14:26:21 -0500
- Subject: Linking libstdc++.a into a shared library.
- Reply-to: stephenw at cryptocard dot com
Something broke an the last few months.
I need to be able to statically link libstdc++.a into one or more shared
libraries. Dynamically linking it to a distributable shared library is a
no-go considering the proprietary nature of Linux distros and the frequent
ABI changes on all platforms.
Using "-static" on the link line doesn't work because that always links to
the shared library.
I used to be able to link using the gcc driver and explicitly linking
libstdc++.a. This is the method of choice (indeed tho only method on Mac OS
X, where -static won't work anyway).
Recently, when I've tried this, I get the following.
/smw/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.3/../../../../i686-pc-linux-gnu/bin/ld:
static: undefined versioned symbol name std::time_put_w@@GLIBCPP_3.2
/smw/gnu/lib/gcc-lib/i686-pc-linux-gnu/3.3/../../../../i686-pc-linux-gnu/bin/ld:
failed to set dynamic section sizes: Bad value
This only happens when using the "-shared" switch and linking in libstdc++.a
explicitly. My latest build is gcc version 3.3 20021125 (experimental), but
the problem also occurs in at least the latest Debian Linux distro of gcc
(I'm not a Debian user, so I don't know exactly what that means).
So, my questions are,
o is there a workaround that doesn't involve editing globals.cc and
rebuilding the library (which won't fly with the other developers here)?
o will this fix itself in the future so it becomes possible once again to
link the c++ runtime statically into dynamically loaded libraries?
--
Stephen M. Webb
stephenw@cryptocard.com