Skip to content

Commit

Permalink
#2320: fix linking with unwind
Browse files Browse the repository at this point in the history
  • Loading branch information
cwschilly committed Jul 31, 2024
1 parent 8a920b2 commit 4c5fb52
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmake/link_vt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function(link_target_with_vt)
endif()

if (NOT DEFINED ARG_LINK_UNWIND AND ${ARG_DEFAULT_LINK_SET} OR ARG_LINK_UNWIND)
if (vt_has_libunwind)
if (vt_feature_cmake_libunwind)
if (${ARG_DEBUG_LINK})
message(STATUS "link_target_with_vt: unwind=${ARG_LINK_UNWIND}")
endif()
Expand Down
6 changes: 3 additions & 3 deletions cmake/load_libunwind.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set(vt_has_libunwind 0)
set(vt_feature_cmake_libunwind "0")

find_package(libunwind)

if(libunwind_FOUND)
set(vt_has_libunwind 1)
if(LIBUNWIND_FOUND)
set(vt_feature_cmake_libunwind "1")
endif()
2 changes: 1 addition & 1 deletion cmake_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#define vt_feature_cmake_debug_verbose @vt_feature_cmake_debug_verbose@
#define vt_feature_cmake_rdma_tests @vt_feature_cmake_rdma_tests@
#define vt_feature_cmake_external_fmt @vt_feature_cmake_external_fmt@
#define vt_feature_cmake_libunwind @vt_feature_cmake_libunwind@

#define vt_detected_max_num_nodes @cmake_detected_max_num_nodes@

Expand All @@ -89,7 +90,6 @@
#cmakedefine vt_has_unistd_h
#cmakedefine vt_has_inttypes_h
#cmakedefine vt_has_sysconf
#cmakedefine vt_has_libunwind
#cmakedefine vt_has_execinfo_h

#if vt_feature_cmake_external_fmt
Expand Down
4 changes: 2 additions & 2 deletions src/vt/configs/error/stack_out.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include <cxxabi.h>

#if defined(vt_has_libunwind)
#if vt_check_enabled(libunwind)
# define UNW_LOCAL_ONLY
# include <libunwind.h>
#elif defined(vt_has_execinfo_h)
Expand All @@ -59,7 +59,7 @@ namespace vt { namespace debug { namespace stack {

DumpStackType dumpStack(int skip) {
DumpStackType stack;
#if defined(vt_has_libunwind)
#if vt_check_enabled(libunwind)

unw_cursor_t cursor;
unw_context_t context;
Expand Down
1 change: 1 addition & 0 deletions src/vt/configs/features/features_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
#define vt_feature_production_build 0 || vt_feature_cmake_production_build
#define vt_feature_debug_verbose 0 || vt_feature_cmake_debug_verbose
#define vt_feature_fmt_external 0 || vt_feature_cmake_external_fmt
#define vt_feature_libunwind 0 || vt_feature_cmake_libunwind

#define vt_check_enabled(test_option) (vt_feature_ ## test_option != 0)

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/configs/test_stack_dumping.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

namespace vt { namespace tests { namespace unit {

#if defined(vt_has_libunwind) || defined(vt_has_execinfo_h)
#if vt_check_enabled(libunwind) || defined(vt_has_execinfo_h)

struct TestStackDumping : TestParallelHarness {};

Expand Down

0 comments on commit 4c5fb52

Please sign in to comment.