haampie / libtree

ldd as a tree
MIT License
2.67k stars 60 forks source link

libree 3.1.1 make check fails on aarch64 on alpine linux #78

Open ncopa opened 2 years ago

ncopa commented 2 years ago
gcc -shared -Wl,-soname,libx.so -o v1/libx.so -Wl,--version-script,v1.map v1.c
gcc -shared -Wl,-soname,libx.so -o v2/libx.so -Wl,--version-script,v2.map v2.c
gcc -o exe_v1 main.c v1/libx.so "-Wl,-rpath,/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/06_symbol_versions/v2" "-Wl,-rpath,/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/06_symbol_versions/v1"
gcc -o exe_v2 main.c v2/libx.so "-Wl,-rpath,/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/06_symbol_versions/v1" "-Wl,-rpath,/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/06_symbol_versions/v2"
../../libtree exe_v1
exe_v1 
└── libx.so [rpath]
../../libtree exe_v2
exe_v2 
└── libx.so [rpath]
make[1]: Leaving directory '/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/06_symbol_versions'
make[1]: Entering directory '/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/04_rpath_over_env_over_runpath'
echo 'int b(){return 10;}' | gcc -shared -Wl,-soname,libb.so -Wl,--no-as-needed -o libb.so -Wno-implicit-function-declaration -nostdlib -x c -
mkdir dir
echo 'int a(){return 42;}' | gcc -shared -Wl,-soname,liba.so -Wl,--no-as-needed -o dir/liba.so -nostdlib -x c -
echo 'int b(){return a();}' | gcc -shared -Wl,-soname,libb.so -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$ORIGIN' -Wno-implicit-function-declaration -o dir/libb.so -nostdlib dir/liba.so -x c -
echo 'int _start(){return b();}' | gcc -Wl,--no-as-needed -Wl,--disable-new-dtags "-Wl,-rpath,/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/04_rpath_over_env_over_runpath" libb.so -o exe_rpath -Wno-implicit-function-declaration -nostdlib -x c -
echo 'int _start(){return b();}' | gcc -Wl,--no-as-needed -Wl,--enable-new-dtags "-Wl,-rpath,/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/04_rpath_over_env_over_runpath" libb.so -o exe_runpath -Wno-implicit-function-declaration -nostdlib -x c -
../../libtree exe_rpath
exe_rpath 
└── libb.so [rpath]
LD_LIBRARY_PATH="/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/04_rpath_over_env_over_runpath/dir" ../../libtree exe_rpath
exe_rpath 
└── libb.so [rpath]
../../libtree exe_runpath
exe_runpath 
└── libb.so [runpath]
LD_LIBRARY_PATH="/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/04_rpath_over_env_over_runpath/dir" ../../libtree exe_runpath
exe_runpath 
└── libb.so [LD_LIBRARY_PATH]
    └── liba.so [rpath]
make[1]: Leaving directory '/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/04_rpath_over_env_over_runpath'
make[1]: Entering directory '/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/05_32_bits'
mkdir -p lib32
mkdir -p lib64
echo 'int a(){return 42;}' | gcc -shared -Wl,-soname,libx.so -m32 -o lib32/libx.so -nostdlib -x c -
echo 'int a(){return 42;}' | gcc -shared -Wl,-soname,libx.so -m64 -o lib64/libx.so -nostdlib -x c -
gcc: error: unrecognized command-line option '-m32'
make[1]: *** [Makefile:16: lib32/libx.so] Error 1
make[1]: *** Waiting for unfinished jobs....
gcc: error: unrecognized command-line option '-m64'
make[1]: *** [Makefile:12: lib64/libx.so] Error 1
make[1]: Leaving directory '/home/ncopa/aports/community/libtree/src/libtree-3.1.1/tests/05_32_bits'
make: *** [Makefile:34: check] Error 1
haampie commented 2 years ago

Hm, maybe those should be conditional

alexmyczko commented 2 years ago

same with debian: https://buildd.debian.org/status/package.php?p=libtree&suite=sid

haampie commented 2 years ago

@ismaell / @iluceno do you have a suggestion for a bmake compatible way to test for say -m32 / -m64 flag support? I don't want to add a configure script. If it's not easy then I'll just stick to gmake for make check targets.

ncopa commented 2 years ago

are there any architectures other than x86_64 that supports multilib with -m32/-m64?

ismaell commented 2 years ago

I'm not sure it makes sense to test for a flag, shouldn't it just explicitly test all the supported ISAs on all the architectures?

ismaell commented 2 years ago

I'll try to come up with a solution compatible with cross-compiling tonight.