This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Shared library without dependence on libgcc_s.so
- From: "Arne Steinarson" <asteinarson at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 6 Jun 2008 13:08:06 +0200
- Subject: Shared library without dependence on libgcc_s.so
Hello,
Working with putting together a Linux installer for an app (to work on
various Linux
versions), I got problems with libgcc_s.so (if distribution is not
based on gcc 4.x the app
won't start).
I wanted to remove dynamic linking to any C++ library (that is outside
of the installer).
The situation is this one in terms of files:
- MyApplication // Executable file by gcc 4.3, in installer
- SharedLib1.so // Shared lib, comes with installer
- SharedLib2.so // Same
- ...
Using flags -static-libgcc and making sure that the linker sees
libstdc++.a and libgcc.a
_before_ any shared library version of the same, the dependency on
libstdc++.so and
libgcc_s.so is cleared. But... only for the executable! The shared
libraries themselves still
have a dependency on libgcc_s.so:
$ ldd libwx_gtk2ud_fwb_core-2.9.so.0 | grep gcc
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6ee8000)
Is it possible to clear this dependence for the shared libraries
(making them back link
into the application for / static lib for this need)?
If not, it seems I have to drop the idea of using C++ shared libs in a
binary to be
used on different distributions.
A page with background info on the subject:
http://alexda.wordpress.com/2007/12/04/c-linking-libstdc-statically/
Good pointers appreciated.
Regards
// ATS.