[Cppcms-users] FreeBSD 11+clang fails to build backtrace.cpp
Brought to you by:
artyom-beilis
From: Nazım C. B. <naz...@ne...> - 2017-02-11 19:02:57
|
Hi Artyom, This looks like related with closed bug "#78 FreeBSD+clang w/ c++11 fails to build backtrace.cpp...". Operating system: $ uname -a FreeBSD web1.bhyve.local 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016 ro...@re...:/usr/obj/usr/src/sys/GENERIC amd64 Compiler: $ clang --version FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0) Target: x86_64-unknown-freebsd11.0 Thread model: posix InstalledDir: /usr/bin When trying to compile CppCMS on this system, compiler generates following errors: $ make [ 0%] Building CXX object booster/CMakeFiles/booster.dir/lib/backtrace/src/backtrace.cpp.o /home/nazim/cppcms/booster/lib/backtrace/src/backtrace.cpp:51:16: error: functions that differ only in their return type cannot be overloaded extern void * _Unwind_GetIP (void *); ~~~~~~ ^ /usr/include/c++/v1/unwind-itanium.h:92:22: note: previous declaration is here extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); ~~~~~~~~ ^ /home/nazim/cppcms/booster/lib/backtrace/src/backtrace.cpp:80:48: error: no matching function for call to '_Unwind_GetIP' d->array[d->total++] = _Unwind_GetIP(context); ^~~~~~~~~~~~~ /usr/include/c++/v1/unwind-itanium.h:92:22: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'struct _Unwind_Context *' extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); ^ 2 errors generated. *** Error code 1 Stop. make[2]: stopped in /usr/home/nazim/cppcms *** Error code 1 Stop. make[1]: stopped in /usr/home/nazim/cppcms *** Error code 1 Stop. make: stopped in /usr/home/nazim/cppcms/booster I already read the conversion on the bug #78. /usr/include/c++/v1/unwind-itanium.h is (indirectly) included by /usr/include/c++/v1/cxxabi.h. backtrace.cpp file includes cxxabi.h at the line #26, but feature testing code in CMakeLists.txt doesn't have such #include directive (which makes CMake to succeed the feature test, while the actual compilation fails). But, if we add following code to the booster's CMakeLists.txt, then the feature test fails and the compilation completes without error. check_cxx_source_compiles( "#include <execinfo.h> int main() { backtrace(0,0); }" BOOSTER_HAVE_EXECINFO) check_cxx_source_compiles( "#include <stdexcept> #include <iostream> #include <stdlib.h> #include <string.h> #include <sstream> #include <typeinfo> #include <new> + + #if defined(__GNUC__) + #include <cxxabi.h> + #endif + extern \"C\" { extern void* _Unwind_GetIP (void *); extern int _Unwind_Backtrace(int (*)(void *,void *),void *); } int main() { _Unwind_Backtrace(0,0); _Unwind_GetIP(0); }" BOOSTER_HAVE_UNWIND_BACKTRACE) Check_cxx_source_compiles( "#include <atomic.h> I am also sending output of 'svn diff' as attachment, for anyone who may experience same issue on the future. Regards, Nazim Can. |