specs and libstdc++ and linux

Benoit Hudson bh@techhouse.brown.edu
Wed Oct 2 12:57:00 GMT 2002


My users don't want to need to know where gcc is.  I've figured out how to
modify the specs so that when we link to the shared gcc_s I add appropriate
flags to add the location of libgcc_s to the rpath.  This appears to be
sufficient on solaris to also catch when libstdc++ is dynamically linked to.

Specifically, I modify:
*link_gcc_c_sequence:
%(my_rpath) %G %L %G

Also, I add:
*my_rpath_flags:
-R /path/to/gcc/lib

*my_rpath:
%{static|static-libgcc:}%{!static:%{!static-libgcc:%{!shared:%{!shared-libgcc:}%
{shared-libgcc:%(my_rpath_flags)}}%{shared:%(my_rpath_flags)}}}


Unfortunately, this hack doesn't work under linux: my_rpath_flags never
gets expanded (I can set it to %eexpanded and no error occurs), which means
that apparently I'm specifying -static or -static-libgcc by default, unless
I am reading the spec wrong.  Despite this, libstdc++ is linked in
dynamically.  

Ideally, I'd want the rpath to be set if and only if I link dynamically to
libstdc++.so or libgcc_s.so ; any ideas on how to achieve this?

        -- Benoît



More information about the Gcc-help mailing list