Skip to content

Commit

Permalink
Allow libdebuginfod to be excluded even if present
Browse files Browse the repository at this point in the history
libdebuginfod support is currently only configurable by the presence of the library itself.

Unfortunately, when using the static libraries the libdebuginfod dependency gets
propagated to users of bcc (e.g. bpftrace), who would have to require it as well.

Introduce ENABLE_LIBDEBUGINFOD to allow overriding libdebuginfod usage
from above. This allows bcc users to decide for themselves if they want
this dependency.
  • Loading branch information
Delyan Kratunov authored and yonghong-song committed Oct 31, 2022
1 parent 822e9a8 commit 8c02729
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ option(ENABLE_EXAMPLES "Build examples" ON)
option(ENABLE_MAN "Build man pages" ON)
option(ENABLE_TESTS "Build tests" ON)
option(RUN_LUA_TESTS "Run lua tests" ON)
option(ENABLE_LIBDEBUGINFOD "Use libdebuginfod as a source of debug symbols" ON)
CMAKE_DEPENDENT_OPTION(ENABLE_CPP_API "Enable C++ API" ON "ENABLE_USDT" OFF)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindLibDebuginfod.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDebuginfod DEFAULT_MSG
LIBDEBUGINFOD_LIBRARIES
LIBDEBUGINFOD_INCLUDE_DIRS)

if (LIBDEBUGINFOD_FOUND)
if (LIBDEBUGINFOD_FOUND AND ENABLE_LIBDEBUGINFOD)
add_definitions(-DHAVE_LIBDEBUGINFOD)
endif (LIBDEBUGINFOD_FOUND)
endif (LIBDEBUGINFOD_FOUND AND ENABLE_LIBDEBUGINFOD)

mark_as_advanced(LIBDEBUGINFOD_INCLUDE_DIRS LIBDEBUGINFOD_LIBRARIES)
4 changes: 2 additions & 2 deletions src/cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/frontends/b)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/frontends/clang)
include_directories(${LLVM_INCLUDE_DIRS})
include_directories(${LIBELF_INCLUDE_DIRS})
if (LIBDEBUGINFOD_FOUND)
if (LIBDEBUGINFOD_FOUND AND ENABLE_LIBDEBUGINFOD)
include_directories(${LIBDEBUGINFOD_INCLUDE_DIRS})
endif (LIBDEBUGINFOD_FOUND)
endif (LIBDEBUGINFOD_FOUND AND ENABLE_LIBDEBUGINFOD)
# todo: if check for kernel version
if (CMAKE_USE_LIBBPF_PACKAGE AND LIBBPF_FOUND)
include_directories(${LIBBPF_INCLUDE_DIRS})
Expand Down

0 comments on commit 8c02729

Please sign in to comment.