This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
libstdc++.so: undefined reference to `backtrace' (FreeBSD,...)
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: libstdc++ at gcc dot gnu dot org, François Dumont <fdumont at gcc dot gnu dot org>, Andreas Tobler <andreast at FreeBSD dot org>
- Date: Fri, 25 May 2018 01:22:44 +0200 (CEST)
- Subject: libstdc++.so: undefined reference to `backtrace' (FreeBSD,...)
Since probably May 8th (if https://gcc.gnu.org/ml/gcc-testresults/2018-05/
has it right) the gcc-testresults@ list refuses the output of a nightly
build I have been operating on i586-unknown-freebsd10.4.
Digging into this a bit, I noticed this is due to lots and lots of
testcases failing:
=== libstdc++ Summary ===
# of expected passes 3317
# of unexpected failures 3732
# of expected failures 5
# of unresolved testcases 3692
# of unsupported tests 775
And digging into this yet a bit further it appears to be due to
undefined references to `backtrace' and `backtrace_symbols`:
~/gcc-ref10-i386/bin/g++ g++.dg/debug/trivial.C -gstabs -O2
/home/gerald/gcc-ref10-i386/lib/gcc/i586-unknown-freebsd10.4/9.0.0/../../../libstdc++.so: undefined reference to `backtrace_symbols'
/home/gerald/gcc-ref10-i386/lib/gcc/i586-unknown-freebsd10.4/9.0.0/../../../libstdc++.so: undefined reference to `backtrace'
collect2: error: ld returned 1 exit status
Digging into it yet a bit further this appears to be caused by
2018-05-08 François Dumont <fdumont@gcc.gnu.org>
* src/c++11/debug.cc [_GLIBCXX_HAVE_EXECINFO_H]: Include execinfo.h.
[_GLIBCXX_HAVE_EXECINFO_H](_Error_formatter::_M_error): Render
backtrace.
Indeed on the FreeBSD 10.4 system hosting the tester
/usr/include/execinfo.h exists and has the following:
size_t backtrace(void **, size_t);
char **backtrace_symbols(void *const *, size_t);
And looking at the respective man page I see
NAME
backtrace — fill in the backtrace of the currently executing thread
LIBRARY
Backtrace Access Library (libexecinfo, -lexecinfo)
This (linking in the library) appears to be the missing piece?
Should this be linked in transparently on FreeBSD platforms?
Gerald