Closed
Bug 781457
Opened 12 years ago
Closed 12 years ago
use of undeclared identifier '_Unwind_Backtrace'
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: jbeich, Assigned: jbeich)
References
()
Details
Attachments
(1 file, 1 obsolete file)
User Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/17.0 Firefox/17.0 Build ID: 20120809002637 Steps to reproduce: 1. Installed libunwind 2. Tried to compile firefox with gcc42 or clang. Actual results: xpcom/base/nsStackWalk.cpp:1197:29: error: use of undeclared identifier '_Unwind_Backtrace' _Unwind_Reason_Code t = _Unwind_Backtrace(unwind_callback, &info); ^ 1 error generated. Expected results: Build succesfully.
Comment on attachment 650465 [details] [diff] [review] define _GNU_SOURCE for _Unwind_Backtrace Unlike recent versions of GCC libunwind and libc++ put _Unwind_Backtrace under _GNU_SOURCE. However, configure script doesn't know this and just checks for the function in unwind.h irregardless of where it came from. http://git.savannah.gnu.org/cgit/libunwind.git/tree/include/unwind.h https://github.com/pathscale/libcxxrt/blob/master/src/unwind-itanium.h
Attachment #650465 -
Flags: review?(dbaron)
How did configure detect the function's presence if it's conditional on _GNU_SOURCE? (You deleted config.cache and reran configure when changing compilers, right?)
(In reply to David Baron [:dbaron] from comment #3) > How did configure detect the function's presence if it's conditional on _GNU_SOURCE? Configure script checks only header presence[1]. Then it goes to check libraries and finds that implicitly linked -lgcc_s provides _Unwind_Backtrace symbol. $ env -i PATH=$PATH gmake conftest -f /dev/null cc conftest.c -o conftest $ cat conftest.c #line 24094 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _Unwind_Backtrace(); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char _Unwind_Backtrace(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub__Unwind_Backtrace) || defined (__stub____Unwind_Backtrace) choke me #else _Unwind_Backtrace(); #endif ; return 0; } [1] more correct check would likely use AC_TRY_COMPILE, e.g. dnl ======================================================== dnl = Support for gcc stack unwinding (from gcc 3.3) dnl ======================================================== if test -z "$SKIP_LIBRARY_CHECKS"; then AC_LANG_CPLUSPLUS AC_MSG_CHECKING([for _Unwind_Backtrace in unwind.h]) AC_TRY_COMPILE([#include <unwind.h>], [_Unwind_Backtrace(0,0)], AC_MSG_RESULT([found]), AC_TRY_COMPILE([#define _GNU_SOURCE #include <unwind.h>], [_Unwind_Backtrace(0,0)], AC_MSG_RESULT([needs -D_GNU_SOURCE]), AC_MSG_RESULT([not found]))) fi
On FreeBSD it usually is Blender port that pulls libunwind by default (CAMERATRACK option). http://www.freshports.org/graphics/blender
Note, clang has unwind.h since 3.1. The header is different from the one used by -stdlib=libc++, it doesn't need _GNU_SOURCE. http://clang.llvm.org/doxygen/unwind_8h_source.html
Comment on attachment 650465 [details] [diff] [review] define _GNU_SOURCE for _Unwind_Backtrace r=dbaron
Attachment #650465 -
Flags: review?(dbaron) → review+
Attachment #650465 -
Attachment is obsolete: true
Keywords: checkin-needed
Comment 9•12 years ago
|
||
Green on Try: https://tbpl.mozilla.org/?tree=Try&rev=1d57b70df30c https://hg.mozilla.org/integration/mozilla-inbound/rev/115bed385a77
Comment 10•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/115bed385a77
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in
before you can comment on or make changes to this bug.
Description
•