Merge pull request #868

15c2b69 common: fix build without libunwind (moneromooo-monero)
f72388c CMakeLists: fix build without libunwind (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2016-06-21 09:30:56 +02:00
commit 03477063ba
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
2 changed files with 3 additions and 2 deletions

View file

@ -249,6 +249,7 @@ if(LIBUNWIND_FOUND)
add_definitions("-DHAVE_LIBUNWIND") add_definitions("-DHAVE_LIBUNWIND")
else() else()
message(STATUS "Stack traces disabled") message(STATUS "Stack traces disabled")
set(LIBUNWIND_LIBRARIES "")
endif() endif()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)

View file

@ -28,8 +28,10 @@
#include "common/stack_trace.h" #include "common/stack_trace.h"
#include "misc_log_ex.h" #include "misc_log_ex.h"
#ifdef HAVE_LIBUNWIND
#define UNW_LOCAL_ONLY #define UNW_LOCAL_ONLY
#include <libunwind.h> #include <libunwind.h>
#endif
#include <cxxabi.h> #include <cxxabi.h>
#include <dlfcn.h> #include <dlfcn.h>
@ -112,8 +114,6 @@ void log_stack_trace(const char *msg)
LOG_PRINT2(log, " " << std::setw(4) << level << std::setbase(16) << std::setw(20) << "0x" << ip << " " << (!status && dsym ? dsym : sym) << " + " << "0x" << off, LOG_LEVEL_0); LOG_PRINT2(log, " " << std::setw(4) << level << std::setbase(16) << std::setw(20) << "0x" << ip << " " << (!status && dsym ? dsym : sym) << " + " << "0x" << off, LOG_LEVEL_0);
free(dsym); free(dsym);
} }
#else
#warning libunwind disabled, no stack traces
#endif #endif
} }