From: John Coyle Date: Thu, 15 Oct 2015 02:54:05 +0000 (-0400) Subject: cmake: musl libc does not implement backtrace. Added feature check and fallback to... X-Git-Tag: v10.0.4~116 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6d860ba46c256709b77faadcec9d399f45aca1de;p=ceph.git cmake: musl libc does not implement backtrace. Added feature check and fallback to libexecinfo. Signed-off-by: John Coyle --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b17e864c2958..674f4b004959 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,6 +113,8 @@ else(${ENABLE_SHARED}) set(CEPH_SHARED STATIC) endif(${ENABLE_SHARED}) +find_package(execinfo) + find_package(udev REQUIRED) set(HAVE_UDEV ${UDEV_FOUND}) diff --git a/cmake/modules/Findexecinfo.cmake b/cmake/modules/Findexecinfo.cmake new file mode 100644 index 000000000000..c6bf7c8448ed --- /dev/null +++ b/cmake/modules/Findexecinfo.cmake @@ -0,0 +1,28 @@ +# - Find execinfo +# Find the execinfo headers and libraries. +# +# EXECINFO_INCLUDE_DIRS - where to find execinfo.h, etc. +# EXECINFO_LIBRARIES - List of libraries when using execinfo. +# EXECINFO_FOUND - True if execinfo found. + +# Look for the header file. +FIND_PATH(EXECINFO_INCLUDE_DIR NAMES execinfo.h) + +# Look for the library. +FIND_LIBRARY(EXECINFO_LIBRARY NAMES execinfo) + +# handle the QUIETLY and REQUIRED arguments and set EXECINFO_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(execinfo DEFAULT_MSG EXECINFO_LIBRARY EXECINFO_INCLUDE_DIR) + +# Copy the results to the output variables. +IF(EXECINFO_FOUND) + SET(EXECINFO_LIBRARIES ${EXECINFO_LIBRARY}) + SET(EXECINFO_INCLUDE_DIRS ${EXECINFO_INCLUDE_DIR}) +ELSE(EXECINFO_FOUND) + SET(EXECINFO_LIBRARIES) + SET(EXECINFO_INCLUDE_DIRS) +ENDIF(EXECINFO_FOUND) + +MARK_AS_ADVANCED(EXECINFO_INCLUDE_DIR EXECINFO_LIBRARY) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2c2de25d7c49..62c8c0f8b2ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -361,7 +361,7 @@ endif(${HAVE_GPERFTOOLS}) add_library(common_utf8 STATIC common/utf8.c) -target_link_libraries(common json_spirit common_utf8 erasure_code rt uuid ${CRYPTO_LIBS} ${Boost_LIBRARIES} ${BLKID_LIBRARIES}) +target_link_libraries(common json_spirit common_utf8 erasure_code rt uuid ${CRYPTO_LIBS} ${Boost_LIBRARIES} ${BLKID_LIBRARIES} ${EXECINFO_LIBRARIES}) if(${WITH_LTTNG}) add_subdirectory(tracing) diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake index 89d7792ee8a9..8e23399306d8 100644 --- a/src/include/config-h.in.cmake +++ b/src/include/config-h.in.cmake @@ -182,6 +182,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_UTIME_H +/* Define if you have the header file. */ +#cmakedefine HAVE_EXECINFO_H + /* Define to 1 if strerror_r returns char *. */ #cmakedefine STRERROR_R_CHAR_P 1