From d2564c731cc10388f8dcb828b54088688713ec84 Mon Sep 17 00:00:00 2001 From: Clayton Wheeler Date: Fri, 17 Dec 2021 11:45:00 -0600 Subject: [PATCH] Find dependencies for statically-linked libdw BackwardConfig.cmake was not explicitly pulling in the dependencies (libelf, libz, etc.) of libdw, which made it fail to link when libdw was built as a static library (and therefore didn't explicitly encode those dependencies). --- BackwardConfig.cmake | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/BackwardConfig.cmake b/BackwardConfig.cmake index c95c0d5..4e0eb90 100644 --- a/BackwardConfig.cmake +++ b/BackwardConfig.cmake @@ -89,8 +89,21 @@ if (${STACK_DETAILS_AUTO_DETECT}) # find libdw find_path(LIBDW_INCLUDE_DIR NAMES "elfutils/libdw.h" "elfutils/libdwfl.h") find_library(LIBDW_LIBRARY dw) + # in case it's statically linked, look for all the possible dependencies + find_library(LIBELF_LIBRARY elf) + find_library(LIBPTHREAD_LIBRARY pthread) + find_library(LIBZ_LIBRARY z) + find_library(LIBBZ2_LIBRARY bz2) + find_library(LIBLZMA_LIBRARY lzma) + find_library(LIBZSTD_LIBRARY zstd) set(LIBDW_INCLUDE_DIRS ${LIBDW_INCLUDE_DIR} ) - set(LIBDW_LIBRARIES ${LIBDW_LIBRARY} ) + set(LIBDW_LIBRARIES ${LIBDW_LIBRARY} + $<$:${LIBELF_LIBRARY}> + $<$:${LIBPTHREAD_LIBRARY}> + $<$:${LIBZ_LIBRARY}> + $<$:${LIBBZ2_LIBRARY}> + $<$:${LIBLZMA_LIBRARY}> + $<$:${LIBZSTD_LIBRARY}>) find_package_handle_standard_args(libdw ${_name_mismatched_arg} REQUIRED_VARS LIBDW_LIBRARY LIBDW_INCLUDE_DIR) mark_as_advanced(LIBDW_INCLUDE_DIR LIBDW_LIBRARY)