Skip to content

Instantly share code, notes, and snippets.

@dalehamel
Last active January 9, 2020 03:56
Show Gist options
  • Save dalehamel/da2f73357cd8cc4e60a1218e562a472b to your computer and use it in GitHub Desktop.
Save dalehamel/da2f73357cd8cc4e60a1218e562a472b to your computer and use it in GitHub Desktop.
BCC patches to build embedded for android
--- embedded_bcc.orig/src/cc/libbpf/include/linux/types.h 2020-01-08 16:33:31.384052137 +0000
+++ embedded_bcc/src/cc/libbpf/include/linux/types.h 2020-01-08 02:22:36.269082225 +0000
@@ -23,7 +23,7 @@
#ifndef __aligned_u64
# define __aligned_u64 __u64 __attribute__((aligned(8)))
#endif
-
+typedef unsigned __bitwise __poll_t;
struct list_head {
struct list_head *next, *prev;
};
--- src.orig/bcc/CMakeLists.txt
+++ src/bcc/CMakeLists.txt
@@ -43,6 +43,11 @@ find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS} ${LLVM_PACKAGE_VERSION}")
find_package(LibElf REQUIRED)
+if(CLANG_DIR)
+ set(CMAKE_FIND_ROOT_PATH "${CLANG_DIR}")
+ include_directories("${CLANG_DIR}/include")
+endif()
+
# clang is linked as a library, but the library path searching is
# primitively supported, unlike libLLVM
set(CLANG_SEARCH "/opt/local/llvm/lib;/usr/lib/llvm-3.7/lib;${LLVM_LIBRARY_DIRS}")
@@ -94,8 +99,11 @@ set(CMAKE_CXX_STANDARD 14)
endif(NOT PYTHON_ONLY AND ENABLE_CLANG_JIT)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${CXX_ISYSTEM_DIRS}")
+if(EXTRA_INCLUDE_PATHS)
+ include_directories("${EXTRA_INCLUDE_PATHS}")
+endif()
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -D__user= -D__force=")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -D__user= -D__force= ${CXX_ISYSTEM_DIRS}")
add_subdirectory(src)
add_subdirectory(introspection)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment