When configured with --enable-shared, Libtool was linking the test programs dynamically and placing the real binaries in .libs/ and wrapper scripts in the build root. objcopy pukes when given these wrapper scripts as input. The simplest workaround is to link libbacktrace into the test programs statically.
Excerpt of build failure with ./configure --enable-shared:
make check-TESTS
make[1]: Entering directory '/var/tmp/portage/sys-libs/libbacktrace-1.0_p20220709/work/libbacktrace-8602fda64e78f1f46563220f2ee9f7e70819c51d'
make[2]: Entering directory '/var/tmp/portage/sys-libs/libbacktrace-1.0_p20220709/work/libbacktrace-8602fda64e78f1f46563220f2ee9f7e70819c51d'
rm -f btest_dwz btest_dwz_common.debug
cp btest btest_dwz_1
cp btest btest_dwz_2
if dwz -m btest_dwz_common.debug btest_dwz_1 btest_dwz_2; then \
rm -f btest_dwz_2; \
mv btest_dwz_1 btest_dwz; \
else \
echo "Ignoring dwz errors, assuming that test passes"; \
cp btest btest_dwz; \
fi
dwz: "btest_dwz_1" is not an ELF file
dwz: "btest_dwz_2" is not an ELF file
dwz: Too few files for multifile optimization
Ignoring dwz errors, assuming that test passes
objcopy --only-keep-debug btest btest_gnudebuglink.debug
objcopy: btest: file format not recognized
make[2]: *** [Makefile:2482: btest_gnudebuglink] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-libs/libbacktrace-1.0_p20220709/work/libbacktrace-8602fda64e78f1f46563220f2ee9f7e70819c51d'
make[1]: *** [Makefile:2008: check-TESTS] Error 2
make[1]: Leaving directory '/var/tmp/portage/sys-libs/libbacktrace-1.0_p20220709/work/libbacktrace-8602fda64e78f1f46563220f2ee9f7e70819c51d'
make: *** [Makefile:2293: check-am] Error 2
The error objcopy: btest: file format not recognized occurs because btest is a libtool wrapper script. The real btest binary executable is at .libs/btest.
Statically linking the test programs, as this PR does, allows the tests to succeed.
When configured with
--enable-shared
, Libtool was linking the test programs dynamically and placing the real binaries in.libs/
and wrapper scripts in the build root.objcopy
pukes when given these wrapper scripts as input. The simplest workaround is to link libbacktrace into the test programs statically.Excerpt of build failure with
./configure --enable-shared
:The error
objcopy: btest: file format not recognized
occurs becausebtest
is a libtool wrapper script. The realbtest
binary executable is at.libs/btest
.Statically linking the test programs, as this PR does, allows the tests to succeed.