Skip to content

Commit

Permalink
Allow build from uncommon bcc installation
Browse files Browse the repository at this point in the history
I'm not able to build bpftrace with bcc being installed
under directory that is not searched by linker by dafault.

Adding -L<dirname ${LIBBCC_LIBDIR}> option, which allows me
to build with:
  $ cmake \
    ...
    -DLIBBCC_INCLUDE_DIRS:PATH=/opt/bcc/include/bcc \
    -DLIBBCC_LIBRARIES:PATH=/opt/bcc/lib64/libbcc.so \
    ...
  • Loading branch information
olsajiri authored and danobi committed Nov 1, 2019
1 parent 4f7fd67 commit 9986329
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -64,6 +64,9 @@ if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()
set(CMAKE_REQUIRED_LIBRARIES bcc)
get_filename_component(LIBBCC_LIBDIR ${LIBBCC_LIBRARIES} DIRECTORY)
set(CMAKE_REQUIRED_LINK_OPTIONS -L${LIBBCC_LIBDIR})

check_symbol_exists(bcc_prog_load "${LIBBCC_INCLUDE_DIRS}/libbpf.h" HAVE_BCC_PROG_LOAD)
check_symbol_exists(bcc_create_map "${LIBBCC_INCLUDE_DIRS}/libbpf.h" HAVE_BCC_CREATE_MAP)
check_symbol_exists(bcc_elf_foreach_sym "${LIBBCC_INCLUDE_DIRS}/bcc_elf.h" HAVE_BCC_ELF_FOREACH_SYM)
Expand Down

0 comments on commit 9986329

Please sign in to comment.