diff --git a/introspection/CMakeLists.txt b/introspection/CMakeLists.txt index 88df6e84..22f934f2 100644 --- a/introspection/CMakeLists.txt +++ b/introspection/CMakeLists.txt @@ -3,11 +3,11 @@ include_directories(${CMAKE_SOURCE_DIR}/src/cc) include_directories(${CMAKE_SOURCE_DIR}/src/cc/api) -include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi) +include_directories(/usr/include/uapi) option(INSTALL_INTROSPECTION "Install BPF introspection tools" ON) add_executable(bps bps.c) -target_link_libraries(bps bpf-static) +target_link_libraries(bps bccbpf-static) install (TARGETS bps DESTINATION share/bcc/introspection) diff --git a/introspection/bps.c b/introspection/bps.c index 4993b8e7..61fc6693 100644 --- a/introspection/bps.c +++ b/introspection/bps.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "libbpf.h" diff --git a/src/cc/CMakeLists.txt b/src/cc/CMakeLists.txt index 59a59856..8dd3535d 100644 --- a/src/cc/CMakeLists.txt +++ b/src/cc/CMakeLists.txt @@ -10,8 +10,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/frontends/clang) include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${LIBELF_INCLUDE_DIRS}) # todo: if check for kernel version -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include/uapi) +include_directories(/usr/include) +include_directories(/usr/include/uapi) add_definitions(${LLVM_DEFINITIONS}) configure_file(libbcc.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libbcc.pc @ONLY) @@ -28,12 +28,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLLVM_MAJOR_VERSION=${CMAKE_MATCH_1}") include(static_libstdc++) -file(GLOB libbpf_sources "libbpf/src/*.c") -add_library(bpf-static STATIC libbpf.c perf_reader.c ${libbpf_sources}) -set_target_properties(bpf-static PROPERTIES OUTPUT_NAME bpf) -add_library(bpf-shared SHARED libbpf.c perf_reader.c ${libbpf_sources}) -set_target_properties(bpf-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0) -set_target_properties(bpf-shared PROPERTIES OUTPUT_NAME bpf) +add_library(bccbpf-static STATIC libbpf.c perf_reader.c) +set_target_properties(bccbpf-static PROPERTIES OUTPUT_NAME bccbpf) +target_link_libraries(bccbpf-static bpf) +add_library(bccbpf-shared SHARED libbpf.c perf_reader.c) +set_target_properties(bccbpf-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0) +set_target_properties(bccbpf-shared PROPERTIES OUTPUT_NAME bccbpf) +target_link_libraries(bccbpf-shared bpf) set(bcc_common_sources bcc_common.cc bpf_module.cc bcc_btf.cc exported_files.cc) if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 6 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 6) @@ -79,11 +80,11 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${llvm_lib_exclude_f # bcc_common_libs_for_a for archive libraries # bcc_common_libs_for_s for shared libraries -set(bcc_common_libs_for_a b_frontend clang_frontend bpf-static +set(bcc_common_libs_for_a b_frontend clang_frontend bccbpf-static bpf -Wl,--whole-archive ${clang_libs} ${llvm_libs} -Wl,--no-whole-archive ${LIBELF_LIBRARIES}) set(bcc_common_libs_for_s ${bcc_common_libs_for_a}) -set(bcc_common_libs_for_lua b_frontend clang_frontend bpf-static +set(bcc_common_libs_for_lua b_frontend clang_frontend bccbpf-static bpf ${clang_libs} ${llvm_libs} ${LIBELF_LIBRARIES}) if(ENABLE_CPP_API) @@ -115,4 +116,4 @@ install(DIRECTORY libbpf/include/uapi/linux/ DESTINATION include/bcc/compat/linu install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libbcc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif(ENABLE_CLANG_JIT) install(FILES ${bcc_common_headers} DESTINATION include/bcc) -install(TARGETS bpf-shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(TARGETS bccbpf-shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/src/cc/bcc_btf.cc b/src/cc/bcc_btf.cc index 881959af..0c6d86a2 100644 --- a/src/cc/bcc_btf.cc +++ b/src/cc/bcc_btf.cc @@ -17,10 +17,12 @@ #include "bcc_btf.h" #include #include + +#include #include "linux/btf.h" #include "libbpf.h" -#include "libbpf/src/libbpf.h" -#include "libbpf/src/btf.h" +#include "bpf/libbpf.h" +#include "bpf/btf.h" #include #define BCC_MAX_ERRNO 4095 diff --git a/src/cc/bpf_module.cc b/src/cc/bpf_module.cc index cf6ea8f3..c5684b84 100644 --- a/src/cc/bpf_module.cc +++ b/src/cc/bpf_module.cc @@ -43,7 +43,7 @@ #include "exported_files.h" #include "libbpf.h" #include "bcc_btf.h" -#include "libbpf/src/bpf.h" +#include "bpf/bpf.h" namespace ebpf { diff --git a/src/cc/libbpf.c b/src/cc/libbpf.c index 9b0024dc..69452623 100644 --- a/src/cc/libbpf.c +++ b/src/cc/libbpf.c @@ -51,8 +51,8 @@ // TODO: Remove this when CentOS 6 support is not needed anymore #include "setns.h" -#include "libbpf/src/bpf.h" -#include "libbpf/src/libbpf.h" +#include "bpf/bpf.h" +#include "bpf/libbpf.h" // TODO: remove these defines when linux-libc-dev exports them properly