[oe] [meta-oe][PATCH v1 3/4] BCC: Add build recipe

Leo Yan leo.yan at linaro.org
Tue Feb 18 05:25:43 UTC 2020


From: Sumit Garg <sumit.garg at linaro.org>

BPF Compiler Collection (BCC) is a toolkit for creating efficient kernel
tracing and manipulation programs, and includes versatile tools and
examples which based on eBPF.  This tool is very widely used on server
section, but we also can use it for embedded system, e.g. use its
function trace utilities (trace.py and argdist.py) to trace kernel
function parameters and return values.

This patch adds recipe for BCC version 0.12.0.  This patch also contains
a patch to change cmake file so can look for libraries and headers which
are installed in target sysroot-recipe path for cross compilation.

Signed-off-by: Sumit Garg <sumit.garg at linaro.org>
Co-developed-by: Leo Yan <leo.yan at linaro.org>
---
 ...-with-OE-LLVM-cross-compiled-package.patch | 32 ++++++++++++++++
 meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb    | 37 +++++++++++++++++++
 2 files changed, 69 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
 create mode 100644 meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb

diff --git a/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch b/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
new file mode 100644
index 000000000..b5acadc1b
--- /dev/null
+++ b/meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch
@@ -0,0 +1,32 @@
+From 93cf25ba663e68a6a6f4237fbe0ef8349b3f37ef Mon Sep 17 00:00:00 2001
+From: Sumit Garg <sumit.garg at linaro.org>
+Date: Fri, 14 Feb 2020 07:40:11 +0000
+Subject: [PATCH] Allow to build with OE LLVM cross compiled package
+
+The default LLVM cmake package requires all libraries, headers and tools
+to be present but in case of cross compilation, OE only provides
+target specific libraries and headers and requires native llvm tools.
+
+So instead of looking for a complete llvm package, look for libraries and
+headers which are installed in target sysroot-recipe path.
+
+Signed-off-by: Sumit Garg <sumit.garg at linaro.org>
+---
+ CMakeLists.txt | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7bd0f3b2..6f1f12c0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -39,8 +39,6 @@ endif()
+ if(NOT PYTHON_ONLY AND ENABLE_CLANG_JIT)
+ find_package(BISON)
+ find_package(FLEX)
+-find_package(LLVM REQUIRED CONFIG)
+-message(STATUS "Found LLVM: ${LLVM_INCLUDE_DIRS} ${LLVM_PACKAGE_VERSION}")
+ find_package(LibElf REQUIRED)
+
+ # clang is linked as a library, but the library path searching is
+--
+2.17.1
diff --git a/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb b/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb
new file mode 100644
index 000000000..687fb64c7
--- /dev/null
+++ b/meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb
@@ -0,0 +1,37 @@
+SUMMARY = "BPF Compiler Collection (BCC)"
+HOMEPAGE = "https://github.com/iovisor/bcc"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e"
+
+DEPENDS += "bison-native \
+            ninja-native \
+            elfutils-native \
+            flex-native \
+            ${MLPREFIX}elfutils \
+            ${MLPREFIX}binutils \
+            ${MLPREFIX}flex \
+            luajit \
+            clang \
+            "
+
+RDEPENDS_${PN} += "bash python"
+
+SRC_URI = "git://github.com/iovisor/bcc \
+           file://0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch \
+           "
+SRCREV = "368a5b0714961953f3e3f61607fa16cb71449c1b"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+EXTRA_OECMAKE = " \
+    -DCMAKE_INSTALL_PREFIX=/usr \
+    -DENABLE_LLVM_SHARED=ON \
+    -DENABLE_CLANG_JIT=ON \
+    -DENABLE_MAN=OFF \
+    -DLLVM_PACKAGE_VERSION=${LLVMVERSION} \
+    -DPYTHON_CMD=python3 \
+"
+
+FILES_${PN} += "${libdir}/python*/dist-packages"
-- 
2.17.1



More information about the Openembedded-devel mailing list