This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug sanitizer/69839] cross-compiling programs w/-fsanitize=address fails: ld: warning: libstdc++.so.6, needed by libasan.so, not found (try using -rpath or -rpath-link)


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69839

--- Comment #8 from Joakim Tjernlund <joakim.tjernlund at infinera dot com> ---
(In reply to Jakub Jelinek from comment #7)
> (In reply to Joakim Tjernlund from comment #6)
> > (In reply to Jakub Jelinek from comment #5)
> > > Likely a bug on the Gentoo side.
> > > The linker handles differently libraries specified on the command line and
> > > libraries that are needed by those shared libraries, but are not mentioned
> > > on the command line.  See binutils documentation.
> > 
> > Digging into this I noticed ld searches $sysroot/etc/ld.so.conf so
> > I tried adding /usr/lib/gcc/powerpc-g2.20-linux-gnu/4.9.3/, like so:
> > # ld.so.conf autogenerated by env-update; make all changes to
> > # contents of /etc/env.d directory
> > /usr/powerpc-g2.20-linux-gnu/lib
> > /usr/lib/gcc/powerpc-g2.20-linux-gnu/4.9.3/
> > 
> > However I see using strace that ld tries to open:
> > "/usr/powerpc-g2.20-linux-gnu/usr/lib/gcc/powerpc-g2.20-linux-gnu/4.9.3/
> > libstdc++.so.6
> > 
> > That is, ld prefixes every path in ld.so.conf with $sysroot.
> > Is that correct or a bug in binutils?
> 
> That is correct.

hmm, this feels a bit odd. Using
sudo /usr/powerpc-g2.20-linux-gnu/sbin/ldconfig -v  -C
/usr/powerpc-g2.20-linux-gnu/etc/ld.so.cache -f
/usr/powerpc-g2.20-linux-gnu/etc/ld.so.conf

and then printing the cache:
/usr/powerpc-g2.20-linux-gnu/sbin/ldconfig -v -p -C
/usr/powerpc-g2.20-linux-gnu/etc/ld.so.cache 50 libs found in cache
`/usr/powerpc-g2.20-linux-gnu/etc/ld.so.cache'
....
        libz.so.1 (libc6) => /usr/powerpc-g2.20-linux-gnu/lib/libz.so.1
        libutil.so.1 (libc6, OS ABI: Linux 2.6.32) =>
/usr/powerpc-g2.20-linux-gnu/lib/libutil.so.1
        libubsan.so.0 (libc6) =>
/usr/lib/gcc/powerpc-g2.20-linux-gnu/4.9.3/libubsan.so.0
        libubsan.so (libc6) =>
/usr/lib/gcc/powerpc-g2.20-linux-gnu/4.9.3/libubsan.so
        libthread_db.so.1 (libc6, OS ABI: Linux 2.6.32) =>
/usr/powerpc-g2.20-linux-gnu/lib/libthread_db.so.1
        libstdc++.so.6 (libc6) =>
/usr/lib/gcc/powerpc-g2.20-linux-gnu/4.9.3/libstdc++.so.6
        libstdc++.so (libc6) =>
/usr/lib/gcc/powerpc-g2.20-linux-gnu/4.9.3/libstdc++.so
        librt.so.1 (libc6, OS ABI: Linux 2.6.32) =>
/usr/powerpc-g2.20-linux-gnu/lib/librt.so.1

it finds and prints my libs.
to it would make more sense to honor the exact paths in ld.so.conf instead.
It is much more flexible.

Why is the current behaviour correct(what problem does it solve)?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]