Mailing List Archive

crossdev and ASAN
cross toolchains cannot use ASAN today:
powerpc-g2.20-linux-gnu-gcc -fsanitize=address mmap.c
/usr/libexec/gcc/powerpc-g2.20-linux-gnu/ld: warning: libstdc++.so.6, needed by /usr/lib/gcc/powerpc-g2.20-
linux-gnu/4.9.3/libasan.so, not found (try using -rpath or -rpath-link)

Perhaps crossdev should install libstdc++ per default?

 Jocke
Re: crossdev and ASAN [ In reply to ]
On Fri, 2015-11-13 at 10:14 +0000, Joakim Tjernlund wrote:
> cross toolchains cannot use ASAN today:
> powerpc-g2.20-linux-gnu-gcc -fsanitize=address mmap.c
> /usr/libexec/gcc/powerpc-g2.20-linux-gnu/ld: warning: libstdc++.so.6, needed by /usr/lib/gcc/powerpc-g2.20-
> linux-gnu/4.9.3/libasan.so, not found (try using -rpath or -rpath-link)
>
> Perhaps crossdev should install libstdc++ per default?
>
>  Jocke

hmm, there is a libstdc++.so.6 which will work to link with under:
 /usr/lib64/gcc/powerpc-g2.20-linux-gnu/4.9.3/libstdc++.so.6
But powerpc-g2.20-linux-gnu-gcc cannot find it there, stracing gcc one can see:

[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/powerpc-g2.20-linux-gnu/lib/../lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/powerpc-g2.20-linux-gnu/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/powerpc-g2.20-linux-gnu/lib32/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/local/lib32/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/lib32/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/lib32/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/powerpc-g2.20-linux-gnu/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/local/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/powerpc-g2.20-linux-gnu/lib/../lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/powerpc-g2.20-linux-gnu/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/powerpc-g2.20-linux-gnu/lib32/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/local/lib32/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/lib32/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/lib32/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/powerpc-g2.20-linux-gnu/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/local/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid  3860] open("/usr/powerpc-g2.20-linux-gnu/usr/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory)
Re: crossdev and ASAN [ In reply to ]
Joakim Tjernlund wrote:
> > cross toolchains cannot use ASAN today:
> > powerpc-g2.20-linux-gnu-gcc -fsanitize=address mmap.c
> > /usr/libexec/gcc/powerpc-g2.20-linux-gnu/ld: warning: libstdc++.so.6, needed by /usr/lib/gcc/powerpc-g2.20-
> > linux-gnu/4.9.3/libasan.so, not found (try using -rpath or -rpath-link)
>
> hmm, there is a libstdc++.so.6 which will work to link with under:
>  /usr/lib64/gcc/powerpc-g2.20-linux-gnu/4.9.3/libstdc++.so.6
> But powerpc-g2.20-linux-gnu-gcc cannot find it there, stracing gcc
> one can see:
>
> [pid  3860] open("/usr/powerpc-g2.20-linux-gnu/...

Is /usr/powerpc-g2.20-linux-gnu the sysroot?
If yes, why is libstdc++.so.6 not in there?
If no, why is gcc looking there?


//Peter
Re: crossdev and ASAN [ In reply to ]
On Fri, 2015-11-13 at 13:16 +0100, Peter Stuge wrote:
> Joakim Tjernlund wrote:
> > > cross toolchains cannot use ASAN today:
> > > powerpc-g2.20-linux-gnu-gcc -fsanitize=address mmap.c
> > > /usr/libexec/gcc/powerpc-g2.20-linux-gnu/ld: warning: libstdc++.so.6, needed by /usr/lib/gcc/powerpc-
> > > g2.20-
> > > linux-gnu/4.9.3/libasan.so, not found (try using -rpath or -rpath-link)
> >
> > hmm, there is a libstdc++.so.6 which will work to link with under:
> >  /usr/lib64/gcc/powerpc-g2.20-linux-gnu/4.9.3/libstdc++.so.6
> > But powerpc-g2.20-linux-gnu-gcc cannot find it there, stracing gcc
> > one can see:
> >
> > [pid  3860] open("/usr/powerpc-g2.20-linux-gnu/...
>
> Is /usr/powerpc-g2.20-linux-gnu the sysroot?
Yes

> If yes, why is libstdc++.so.6 not in there?

I think it is because cross-powerpc-g2.20-linux-gnu/glibc is special, it is not
the real/whole glibc, just the stuff needed x-compile.
But as there is and /usr/lib64/gcc/powerpc-g2.20-linux-gnu/4.9.3/libstdc++.so.6 gcc
shoudl look there? libasan.so.1 lives there also.

Speaking of libasan.so, it has an odd runpath:
0x0000001d (RUNPATH) Library runpath: [/usr/powerpc-g2.20-linux-gnu/lib/../lib]

My host has(amd64):
0x000000000000001d (RUNPATH) Library runpath: [/usr/lib/../lib64]

 Jocke

> If no, why is gcc looking there?
>
>
> //Peter

Re: crossdev and ASAN [ In reply to ]
On Fri, Nov 13, 2015 at 01:17:05PM +0000, Joakim Tjernlund wrote:
>
> I think it is because cross-powerpc-g2.20-linux-gnu/glibc is special, it is not
> the real/whole glibc, just the stuff needed x-compile.

cross-.../glibc is the real deal - it has everything needed for
x-compilation and at runtime. libstdc++ is part of cross-.../gcc, and I
guess mostly meant for development.

> But as there is and /usr/lib64/gcc/powerpc-g2.20-linux-gnu/4.9.3/libstdc++.so.6 gcc
> shoudl look there? libasan.so.1 lives there also.

g++ will look there because it will explicitly link against libstd++ in
all cases.

I guess the warning is trying to tell you that libstdc++ is not in the
default runtime lib search path _and_ that the library is an implicit
dependency of libasan. You'll see that if you add `-lstdc++` to the
compile command it won't mention a thing.

What's your use case anyway? If you want libstdc++ in the sysroot you
either cross-emerge gcc or just copy libstdc++ over. Or maybe static
linking?