Problems with out libgcc_s.so in base

Steve Kargl sgk at troutmask.apl.washington.edu
Thu Aug 18 23:50:56 UTC 2016


On Fri, Aug 19, 2016 at 01:14:32AM +0200, Tijl Coosemans wrote:
> > 
> > For example, on one of my systems, I now have these:
> > 
> > /usr/local/lib/gcc47/libgcc_s.so.1
> > /usr/local/lib/gcc48/libgcc_s.so.1
> > /usr/local/lib/gcc49/libgcc_s.so.1
> > /usr/local/lib/gcc5/libgcc_s.so.1
> > /usr/local/lib/gcc6/libgcc_s.so.1
> > /usr/local/lib/gcc7/libgcc_s.so.1
> > 
> > So which one are you going to put at the front of the path?  The gcc7
> > version?  If you are lucky that one is backwards compatible with all the
> > previous ones, but still I would like it much better if a program
> > compiled by, say, gcc5 was linked *explicitly* against the gcc5 version
> > of libgcc_s.so.
> > 
> > Steve's proposed scheme solves that quite nicely, in my opinion.  The
> > problem is only in the details, as usual.  There will be many configure
> > scripts and libtool-like utilities out there, that assume libgcc must be
> > linked using -lgcc_s, not -lgcc_s$VERSION.
> 
> I now noticed there is a FAQ about this at
> https://gcc.gnu.org/faq.html#rpath.  It gives some suggestions including
> creating wrapper scripts, but they wouldn't work when code is compiled
> with gfortran but linked with Clang cc/c++.  The only thing that works
> in this case is -Wl,-rpath.  Another option would be to create a port
> that installs a recent version of libgcc in /usr/local/lib and let the
> gcc ports use that instead of their own copy.

elfdump -a libgfortran.so.3 shows

dynamic:

entry: 0
	d_tag: DT_NEEDED
	d_val: libquadmath.so.0

entry: 1
	d_tag: DT_NEEDED
	d_val: libm.so.5

entry: 2
	d_tag: DT_NEEDED
	d_val: libgcc_s.so.1

entry: 3
	d_tag: DT_NEEDED
	d_val: libc.so.7

entry: 4
	d_tag: DT_SONAME
	d_val: libgfortran.so.3

entry: 5
	d_tag: DT_RPATH
	d_val: /usr/local/lib/gcc6

I don't know how ELF or the ldd work, but shouldn't the DT_RPATH
tell ldd to look for all of the above libraries in /usr/local/lib/gcc6
first.  If a library isn't present, it would then look in ldconfig's
hints file or fallback to /lib and /usr/lib/.  But, I suppose we 
still run into issues as libgfortran.so.3 needs its companion libgcc_s.s.1
from DT_RPATH and libc.so.7 expects the one from /lib (or perhaps
libcxxrt.so.1?).



-- 
Steve


More information about the freebsd-ports mailing list