------- Comment #9 from redi at gcc dot gnu dot org  2010-04-21 16:08 -------
I've just been bitten by this on Solaris 10, and I think lots more people will
be now that gcc 4.5.0 has been released.

The problem is made worse if libstdc++ (or libgomp etc.) is built with symbol
versioning enabled because libstdc++.so.6 depends on "libgcc_s.so.1
(GCC_4.2.0)" rather than just "libgcc_s.so.1"

The 4.2.0 version is needed for _Unwind_GetIPInfo which was added in 4.2.0 (see
Bug 27880 et al) and symbol versioning was not used by default on Solaris prior
to 4.5.0, see Bug 38923

It is not enough to set the executable's RPATH because, as mentioned in comment
6, only the RPATH in libstdc++.so is used when resolving its dependencies, not
the RPATH in the executable.  I believe this is a difference between Solaris
and Linux, I think Linux's ld.so uses the executable's RPATH when searching for
a shared library's dependencies, Solaris' ld.so.1 *only* uses the RPATH in the
shared library when searching for that library's dependncies.

This forces the user to use LD_LIBRARY_PATH, rather than letting them choose
whether they want to use environment variables at runtime or rely on link-time
RPATH values.  Whether you think LD_LIBRARY_PATH is more or less evil than
RPATH is your business, but I want to be able to make my own decision.

I agree that libstdc++ should set RPATH to $ORIGIN, at least on Solaris.  It's
less important on Linux, since setting RPATH in the final executable will find
the desired libgcc_s.so

I've removed i686-linux from the Host field, since this is not specific to
Linux and is actually a bigger problem on Solaris, where if libgcc_s.so is
installed at all it is usually a much older version than on modern Linux
distros e.g. /usr/sfw/bin/gcc is 3.4.3 on Solaris 10

My workaround is to export LD_RUN_PATH='$ORIGIN' in my environment before I
build gcc, but it would be nice if there was a configure option to do that for
all the libs that depend on libgcc_s.so


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redi at gcc dot gnu dot org
   GCC host triplet|i686-pc-linux               |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32354

Reply via email to