You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2018/11/02 00:41:26 UTC

[arrow] branch master updated: ARROW-3670: [C++] Use FindBacktrace to find execinfo.h support

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new e65663c  ARROW-3670: [C++] Use FindBacktrace to find execinfo.h support
e65663c is described below

commit e65663c45e495ad51b22fced23f5f3d356696984
Author: Korn, Uwe <Uw...@blue-yonder.com>
AuthorDate: Fri Nov 2 09:41:10 2018 +0900

    ARROW-3670: [C++] Use FindBacktrace to find execinfo.h support
    
    Author: Korn, Uwe <Uw...@blue-yonder.com>
    
    Closes #2889 from xhochy/ARROW-3670 and squashes the following commits:
    
    5df3580f <Korn, Uwe> ARROW-3670:  Use FindBacktrace to find execinfo.h support
---
 cpp/src/arrow/CMakeLists.txt  | 6 ++++++
 cpp/src/arrow/util/logging.cc | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt
index 63c1bf2..e026cc1 100644
--- a/cpp/src/arrow/CMakeLists.txt
+++ b/cpp/src/arrow/CMakeLists.txt
@@ -170,9 +170,15 @@ ADD_ARROW_LIB(arrow
   STATIC_PRIVATE_LINK_LIBS ${ARROW_STATIC_PRIVATE_LINK_LIBS}
 )
 
+find_package(Backtrace)
+
 foreach(LIB_TARGET ${ARROW_LIBRARIES})
   target_compile_definitions(${LIB_TARGET}
     PRIVATE ARROW_EXPORTING)
+  if (Backtrace_FOUND)
+    target_compile_definitions(${LIB_TARGET}
+      PRIVATE ARROW_WITH_BACKTRACE)
+  endif()
 endforeach()
 
 if (ARROW_BUILD_STATIC AND WIN32)
diff --git a/cpp/src/arrow/util/logging.cc b/cpp/src/arrow/util/logging.cc
index b135d11..343e8b0 100644
--- a/cpp/src/arrow/util/logging.cc
+++ b/cpp/src/arrow/util/logging.cc
@@ -68,7 +68,7 @@ class CerrLog {
   bool has_logged_;
 
   void PrintBackTrace() {
-#if defined(_EXECINFO_H) || !defined(_WIN32)
+#ifdef ARROW_WITH_BACKTRACE
     void* buffer[255];
     const int calls = backtrace(buffer, static_cast<int>(sizeof(buffer) / sizeof(void*)));
     backtrace_symbols_fd(buffer, calls, 1);