Skip to content

Commit fc9e882

Browse files
kuznetsssPeterChen13579
authored andcommitted
fix: Fix backtrace usage (XRPLF#1932)
1 parent b50a4bc commit fc9e882

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

cmake/deps/libbacktrace.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if (Boost_STACKTRACE_FOUND)
1+
if ("${san}" STREQUAL "")
22
target_compile_definitions(clio_options INTERFACE BOOST_STACKTRACE_LINK)
33
target_compile_definitions(clio_options INTERFACE BOOST_STACKTRACE_USE_BACKTRACE)
44
find_package(libbacktrace REQUIRED CONFIG)
@@ -7,4 +7,5 @@ else ()
77
# capabilities and there are conflicts. In any case, this makes sure Clio code knows that backtrace is not available.
88
# See relevant conan profiles for sanitizers where we disable stacktrace in Boost explicitly.
99
target_compile_definitions(clio_options INTERFACE CLIO_WITHOUT_STACKTRACE)
10+
message(STATUS "Sanitizer enabled, disabling stacktrace")
1011
endif ()

src/util/CMakeLists.txt

+6-12
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,15 @@ target_sources(
3838
newconfig/ValueView.cpp
3939
)
4040

41+
# This must be above the target_link_libraries call otherwise backtrace doesn't work
42+
if ("${san}" STREQUAL "")
43+
target_link_libraries(clio_util PUBLIC Boost::stacktrace_backtrace dl libbacktrace::libbacktrace)
44+
endif ()
45+
4146
target_link_libraries(
42-
clio_util
43-
PUBLIC Boost::headers
44-
dl
45-
fmt::fmt
46-
openssl::openssl
47-
xrpl::libxrpl
48-
Threads::Threads
49-
clio_options
47+
clio_util PUBLIC Boost::headers fmt::fmt openssl::openssl xrpl::libxrpl Threads::Threads clio_options
5048
)
5149

52-
if (!san)
53-
target_link_libraries(clio_util PUBLIC Boost::stacktrace_backtrace libbacktrace::libbacktrace)
54-
endif ()
55-
5650
# FIXME: needed on gcc-12, clang-16 and AppleClang for now (known boost 1.82 issue for some compilers)
5751
#
5852
# For some reason cmake doesn't propagate the compile definitions from clio_options so we need to add them here

0 commit comments

Comments
 (0)