Commit 5e4f665c authored by Chad Austin's avatar Chad Austin Committed by Facebook GitHub Bot

only use symbolizer if libunwind is found

Summary: folly/experimental/symbolizer requires libunwind. Do not enable it unless libunwind is available.

Reviewed By: yfeldblum, luciang

Differential Revision: D22964401

fbshipit-source-id: d71991346927fbf18167637770b2143c03b16476
parent c452ce03
...@@ -145,16 +145,18 @@ if (PYTHON_EXTENSIONS) ...@@ -145,16 +145,18 @@ if (PYTHON_EXTENSIONS)
find_package(Cython 0.26 REQUIRED) find_package(Cython 0.26 REQUIRED)
endif () endif ()
find_package(LibUnwind)
list(APPEND FOLLY_LINK_LIBRARIES ${LIBUNWIND_LIBRARIES})
list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBUNWIND_INCLUDE_DIRS})
set(FOLLY_USE_SYMBOLIZER OFF) set(FOLLY_USE_SYMBOLIZER OFF)
CHECK_INCLUDE_FILE_CXX(elf.h FOLLY_HAVE_ELF_H) CHECK_INCLUDE_FILE_CXX(elf.h FOLLY_HAVE_ELF)
find_library(UNWIND_LIBRARIES NAMES unwind) if (LIBUNWIND_FOUND)
if (UNWIND_LIBRARIES)
list(APPEND FOLLY_LINK_LIBRARIES ${UNWIND_LIBRARIES})
list(APPEND CMAKE_REQUIRED_LIBRARIES ${UNWIND_LIBRARIES}) list(APPEND CMAKE_REQUIRED_LIBRARIES ${UNWIND_LIBRARIES})
endif() endif()
find_package(Backtrace) find_package(Backtrace)
set(FOLLY_HAVE_BACKTRACE ${Backtrace_FOUND}) set(FOLLY_HAVE_BACKTRACE ${Backtrace_FOUND})
if (FOLLY_HAVE_ELF_H AND FOLLY_HAVE_BACKTRACE AND LIBDWARF_FOUND) if (FOLLY_HAVE_ELF AND FOLLY_HAVE_BACKTRACE AND LIBUNWIND_FOUND AND LIBDWARF_FOUND)
set(FOLLY_USE_SYMBOLIZER ON) set(FOLLY_USE_SYMBOLIZER ON)
endif() endif()
message(STATUS "Setting FOLLY_USE_SYMBOLIZER: ${FOLLY_USE_SYMBOLIZER}") message(STATUS "Setting FOLLY_USE_SYMBOLIZER: ${FOLLY_USE_SYMBOLIZER}")
...@@ -241,4 +243,3 @@ target_link_libraries(folly_deps INTERFACE ...@@ -241,4 +243,3 @@ target_link_libraries(folly_deps INTERFACE
${FOLLY_SHINY_DEPENDENCIES} ${FOLLY_SHINY_DEPENDENCIES}
${FOLLY_ASAN_FLAGS} ${FOLLY_ASAN_FLAGS}
) )
# Copyright (c) Facebook, Inc. and its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
find_path(LIBUNWIND_INCLUDE_DIR NAMES libunwind.h)
mark_as_advanced(LIBUNWIND_INCLUDE_DIR)
find_library(LIBUNWIND_LIBRARY NAMES unwind)
mark_as_advanced(LIBUNWIND_LIBRARY)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LIBUNWIND
REQUIRED_VARS LIBUNWIND_LIBRARY LIBUNWIND_INCLUDE_DIR)
if(LIBUNWIND_FOUND)
set(LIBUNWIND_LIBRARIES ${LIBUNWIND_LIBRARY})
set(LIBUNWIND_INCLUDE_DIRS ${LIBUNWIND_INCLUDE_DIR})
endif()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment