/tmp/guix-build-libtree-3.1.1.drv-0/source/tests/08_nodeflib$ make check
echo 'int f(){return 1;}' | cc -z nodefaultlib -Wl,--no-as-needed -shared -Wl,-soname,lib_nodefaultlib.so -o lib_nodefaultlib.so -x c -
echo 'int g(){return 1;}' | cc -Wl,--no-as-needed -shared -Wl,-soname,lib_defaultlib.so -o lib_defaultlib.so -x c -
echo 'extern int f(); extern int g(); int main(){return f() + g();}' | cc -z nodefaultlib -o exe_a -Wl,--enable-new-dtags '-Wl,-rpath,$ORIGIN' -x c - -L. -l_nodefaultlib -l_defaultlib
echo 'extern int g(); int main(){return g();}' | cc -z nodefaultlib -o exe_b -Wl,--disable-new-dtags '-Wl,-rpath,$ORIGIN' -x c - -L. -l_defaultlib
! ../../libtree -vvv exe_a # should likely not find libc
exe_a
├── lib_nodefaultlib.so [runpath]
│ └── libc.so.6 [runpath]
│ └── ld-linux-x86-64.so.2 [ld.so.conf]
├── lib_defaultlib.so [runpath]
│ └── libc.so.6 [runpath]
│ └── ld-linux-x86-64.so.2 [ld.so.conf]
└── libc.so.6 [runpath]
└── ld-linux-x86-64.so.2 [ld.so.conf]
make: *** [Makefile:33: check] Error 1
As far as I can see, the issue is that libtree finds libc when it shouldn't. I'm using the following compiler and linker versions:
$ gcc --version
gcc (GCC) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ ld --version
GNU ld (GNU Binutils) 2.37
Copyright (C) 2021 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
Hello,
when I try to run tests, '08_nodeflib' fails:
As far as I can see, the issue is that
libtree
findslibc
when it shouldn't. I'm using the following compiler and linker versions:The tests ran on Ubuntu 20.04.4 LTS
Thanks, avp