Skip to contentSkip to conversation

eBPF tools: Add recipes

PATCH Superseded Leo Yan 2 participants 12 messages Feb 18, 2020 – Feb 21, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Leo Yan

author
#0 lore raw

cover eBPF tools: Add recipes

This patch series add recipes for three eBPF tools into OpenEmbedded:
Ply, BCC and bpftrace; BCC is dependent on luajit so also adds a recipe for luajit 2.1.0-beta3 building.

These tools have been tested with MACHINE=qemuarm64 building.

Leo Yan (2):
Ply: Add recipe for git version
luajit: Add luajit 2.1.0-beta3 recipe

Sumit Garg (2):
BCC: Add build recipe
bpftrace: Add build recipe

 ...-with-OE-LLVM-cross-compiled-package.patch | 32 +++++++
 meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb    | 37 ++++++++
 ...ith-OE-llvm-clang-cross-compiled-pac.patch | 65 +++++++++++++
 .../bpftrace/bpftrace_0.9.4.bb                | 34 +++++++
 .../recipes-devtools/luajit/luajit_2.1.0.bb   | 92 +++++++++++++++++++
 meta-oe/recipes-devtools/ply/ply_git.bb       | 27 ++++++
 6 files changed, 287 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
 create mode 100644 meta-oe/recipes-devtools/bpftrace/bpftrace/0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch
 create mode 100644 meta-oe/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
 create mode 100644 meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb
 create mode 100644 meta-oe/recipes-devtools/ply/ply_git.bb
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/4 Ply: Add recipe for git version

Ply is a light-weight eBPF tool which compiles ply script or one-liner to Linux BPF programs and attaches to kprobes and tracepoints. It doesn't require external dependencies except libc, so it's very friendly for embedded system usage.

This patch adds the recipe to support ply building for git version.

---
 meta-oe/recipes-devtools/ply/ply_git.bb | 27 +++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ply/ply_git.bb
meta-oe/recipes-devtools/ply/ply_git.bb new file +27 -0
new file mode 100644
index 000000000..b8295386c
@@ -0,0 +1,27 @@
+SUMMARY = "Ply: A light-weight dynamic tracer for eBPF"
+HOMEPAGE = "https://github.com/iovisor/ply"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+DEPENDS += "bison-native"
+
+SRC_URI = "git://github.com/iovisor/ply"
+SRCREV = "aa5b9ac31307ec1acece818be334ef801c802a12"
+
+S = "${WORKDIR}/git"
+
+do_configure_prepend() {
+    ( cd ${S}; ./autogen.sh; cd - )
+}
+
+do_configure() {
+    ( cd ${S}; ./configure --host=${TARGET_SYS} --prefix=${D}${prefix}; cd - )
+}
+
+do_compile() {
+    ( cd ${S}; oe_runmake; cd - )
+}
+
+do_install() {
+    ( cd ${S}; oe_runmake install; cd - )
+}
Signature · 1 line
2.17.1
#2 lore raw

Re: [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version

fails to build fot x86/musl
http://errors.yoctoproject.org/Errors/Details/391871/

Quoted 55 lines · Leo Yan

Ply is a light-weight eBPF tool which compiles ply script or one-liner to Linux BPF programs and attaches to kprobes and tracepoints. It doesn't require external dependencies except libc, so it's very friendly for embedded system usage.

This patch adds the recipe to support ply building for git version.

---
 meta-oe/recipes-devtools/ply/ply_git.bb | 27 +++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/ply/ply_git.bb
meta-oe/recipes-devtools/ply/ply_git.bb new file +27 -1
new file mode 100644
index 000000000..b8295386c
@@ -0,0 +1,27 @@
+SUMMARY = "Ply: A light-weight dynamic tracer for eBPF"
+HOMEPAGE = "https://github.com/iovisor/ply"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
+
+DEPENDS += "bison-native"
+
+SRC_URI = "git://github.com/iovisor/ply"
+SRCREV = "aa5b9ac31307ec1acece818be334ef801c802a12"
+
+S = "${WORKDIR}/git"
+
+do_configure_prepend() {
+    ( cd ${S}; ./autogen.sh; cd - )
+}
+
+do_configure() {
+    ( cd ${S}; ./configure --host=${TARGET_SYS} --prefix=${D}${prefix}; cd - )
+}
+
+do_compile() {
+    ( cd ${S}; oe_runmake; cd - )
+}
+
+do_install() {
+    ( cd ${S}; oe_runmake install; cd - )
+}
--

2.17.1

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

author
#3 lore raw

Re: [meta-oe][PATCH v1 1/4] Ply: Add recipe for git version

Hi Khem,

Quoted 2 lines · Khem Raj

fails to build fot x86/musl
http://errors.yoctoproject.org/Errors/Details/391871/

Ply doesn't support x86 and it supports x86_64. Will fix the dependency issue in the new patch with adding two lines:

COMPATIBLE_HOST_i586 = 'null'
COMPATIBLE_HOST_i686 = 'null'

Thanks a lot for the testing; will send new patch with addressing your comments and test on qemux86 and qemux86_64.

Thanks,
Leo

author
#4 lore raw

PATCH 2/4 luajit: Add luajit 2.1.0-beta3 recipe

In reply to Leo Yan

Since luajit 2.1.0-beta3 can support architecture aarch64 and the old misses to support aarch64, this patch adds recipe for luajit 2.1.0-beta3 building.

---
 .../recipes-devtools/luajit/luajit_2.1.0.bb   | 92 +++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb
meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb new file +92 -0
new file mode 100644
index 000000000..167b5d229
@@ -0,0 +1,92 @@
+SUMMARY = "Just-In-Time Compiler for Lua"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=10a96c93403affcc34765f4c2612bc22"
+HOMEPAGE = "http://luajit.org"
+
+PV .= "+git${SRCPV}"
+SRCREV = "v2.1.0-beta3"
+SRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1"
+
+S = "${WORKDIR}/git"
+
+inherit pkgconfig binconfig siteinfo
+
+BBCLASSEXTEND = "native"
+
+# http://luajit.org/install.html#cross
+# Host luajit needs to be compiled with the same pointer size
+# If you want to cross-compile to any 32 bit target on an x64 OS,
+# you need to install the multilib development package (e.g.
+# libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
+# (HOST_CC="gcc -m32").
+BUILD_CC_ARCH_append = " ${@['-m32',''][d.getVar('SITEINFO_BITS') != '32']}"
+
+# The lua makefiles expect the TARGET_SYS to be from uname -s
+# Values: Windows, Linux, Darwin, iOS, SunOS, PS3, GNU/kFreeBSD
+LUA_TARGET_OS = "Unknown"
+LUA_TARGET_OS_darwin = "Darwin"
+LUA_TARGET_OS_linux = "Linux"
+LUA_TARGET_OS_linux-gnueabi = "Linux"
+LUA_TARGET_OS_mingw32 = "Windows"
+
+# We don't want the lua buildsystem's compiler optimizations, or its
+# stripping, and we don't want it to pick up CFLAGS or LDFLAGS, as those apply
+# to both host and target compiles
+EXTRA_OEMAKE = "\
+    Q= E='@:' \
+    \
+    CCOPT= CCOPT_x86= CFLAGS= LDFLAGS= TARGET_STRIP='@:' \
+    \
+    'TARGET_SYS=${LUA_TARGET_OS}' \
+    \
+    'CC=${CC}' \
+    'TARGET_AR=${AR} rcus' \
+    'TARGET_CFLAGS=${CFLAGS}' \
+    'TARGET_LDFLAGS=${LDFLAGS}' \
+    'TARGET_SHLDFLAGS=${LDFLAGS}' \
+    'HOST_CC=${BUILD_CC}' \
+    'HOST_CFLAGS=${BUILD_CFLAGS}' \
+    \
+    'PREFIX=${prefix}' \
+    'MULTILIB=${baselib}' \
+    'LDCONFIG=:' \
+"
+
+do_compile () {
+    oe_runmake
+}
+
+# There's INSTALL_LIB and INSTALL_SHARE also, but the lua binary hardcodes the
+# '/share' and '/' + LUA_MULTILIB paths, so we don't want to break those
+# expectations.
+EXTRA_OEMAKEINST = "\
+    'DESTDIR=${D}' \
+    'INSTALL_BIN=${D}${bindir}' \
+    'INSTALL_INC=${D}${includedir}/luajit-$(MAJVER).$(MINVER)' \
+    'INSTALL_MAN=${D}${mandir}/man1' \
+"
+do_install () {
+    oe_runmake ${EXTRA_OEMAKEINST} install
+    rmdir ${D}${datadir}/lua/5.* \
+          ${D}${datadir}/lua \
+          ${D}${libdir}/lua/5.* \
+          ${D}${libdir}/lua
+}
+
+PACKAGES += 'luajit-common'
+
+# See the comment for EXTRA_OEMAKEINST. This is needed to ensure the hardcoded
+# paths are packaged regardless of what the libdir and datadir paths are.
+FILES_${PN} += "${prefix}/${baselib} ${prefix}/share"
+FILES_${PN} += "${libdir}/libluajit-5.1.so.2 \
+    ${libdir}/libluajit-5.1.so.${PV} \
+"
+FILES_${PN}-dev += "${libdir}/libluajit-5.1.a \
+    ${libdir}/libluajit-5.1.so \
+    ${libdir}/pkgconfig/luajit.pc \
+"
+FILES_luajit-common = "${datadir}/${BPN}-${PV}"
+
+# mips64 is not supported in this release
+COMPATIBLE_HOST_mipsarchn32 = "null"
+COMPATIBLE_HOST_mipsarchn64 = "null"
Signature · 1 line
2.17.1
#5 lore raw

Re: [meta-oe][PATCH v1 2/4] luajit: Add luajit 2.1.0-beta3 recipe

Quoted 16 lines · Leo Yan

Since luajit 2.1.0-beta3 can support architecture aarch64 and the old misses to support aarch64, this patch adds recipe for luajit 2.1.0-beta3 building.

---
  .../recipes-devtools/luajit/luajit_2.1.0.bb   | 92 +++++++++++++++++++
  1 file changed, 92 insertions(+)

create mode 100644 meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb

meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb new file +0 -0
new file mode 100644
index 000000000..167b5d229

meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb line 6

Quoted 6 lines
meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb new file +6 -0
@@ -0,0 +1,92 @@
+SUMMARY = "Just-In-Time Compiler for Lua"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=10a96c93403affcc34765f4c2612bc22"
+HOMEPAGE = "http://luajit.org"
+
+PV .= "+git${SRCPV}"

I think its best to call it 2.0.5+${SRCPV}

meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb line 7

Quoted 1 line
meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb new file +1 -0
+SRCREV = "v2.1.0-beta3"

Please use corresponding SHA1 here instead of tags

Quoted 75 lines
meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb new file +75 -0
+SRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1"
+
+S = "${WORKDIR}/git"
+
+inherit pkgconfig binconfig siteinfo
+
+BBCLASSEXTEND = "native"
+
+# http://luajit.org/install.html#cross
+# Host luajit needs to be compiled with the same pointer size
+# If you want to cross-compile to any 32 bit target on an x64 OS,
+# you need to install the multilib development package (e.g.
+# libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
+# (HOST_CC="gcc -m32").
+BUILD_CC_ARCH_append = " ${@['-m32',''][d.getVar('SITEINFO_BITS') != '32']}"
+
+# The lua makefiles expect the TARGET_SYS to be from uname -s
+# Values: Windows, Linux, Darwin, iOS, SunOS, PS3, GNU/kFreeBSD
+LUA_TARGET_OS = "Unknown"
+LUA_TARGET_OS_darwin = "Darwin"
+LUA_TARGET_OS_linux = "Linux"
+LUA_TARGET_OS_linux-gnueabi = "Linux"
+LUA_TARGET_OS_mingw32 = "Windows"
+
+# We don't want the lua buildsystem's compiler optimizations, or its
+# stripping, and we don't want it to pick up CFLAGS or LDFLAGS, as those apply
+# to both host and target compiles
+EXTRA_OEMAKE = "\
+    Q= E='@:' \
+    \
+    CCOPT= CCOPT_x86= CFLAGS= LDFLAGS= TARGET_STRIP='@:' \
+    \
+    'TARGET_SYS=${LUA_TARGET_OS}' \
+    \
+    'CC=${CC}' \
+    'TARGET_AR=${AR} rcus' \
+    'TARGET_CFLAGS=${CFLAGS}' \
+    'TARGET_LDFLAGS=${LDFLAGS}' \
+    'TARGET_SHLDFLAGS=${LDFLAGS}' \
+    'HOST_CC=${BUILD_CC}' \
+    'HOST_CFLAGS=${BUILD_CFLAGS}' \
+    \
+    'PREFIX=${prefix}' \
+    'MULTILIB=${baselib}' \
+    'LDCONFIG=:' \
+"
+
+do_compile () {
+    oe_runmake
+}
+
+# There's INSTALL_LIB and INSTALL_SHARE also, but the lua binary hardcodes the
+# '/share' and '/' + LUA_MULTILIB paths, so we don't want to break those
+# expectations.
+EXTRA_OEMAKEINST = "\
+    'DESTDIR=${D}' \
+    'INSTALL_BIN=${D}${bindir}' \
+    'INSTALL_INC=${D}${includedir}/luajit-$(MAJVER).$(MINVER)' \
+    'INSTALL_MAN=${D}${mandir}/man1' \
+"
+do_install () {
+    oe_runmake ${EXTRA_OEMAKEINST} install
+    rmdir ${D}${datadir}/lua/5.* \
+          ${D}${datadir}/lua \
+          ${D}${libdir}/lua/5.* \
+          ${D}${libdir}/lua
+}
+
+PACKAGES += 'luajit-common'
+
+# See the comment for EXTRA_OEMAKEINST. This is needed to ensure the hardcoded
+# paths are packaged regardless of what the libdir and datadir paths are.
+FILES_${PN} += "${prefix}/${baselib} ${prefix}/share"
+FILES_${PN} += "${libdir}/libluajit-5.1.so.2 \
+    ${libdir}/libluajit-5.1.so.${PV} \

meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb line 92

Quoted 10 lines
meta-oe/recipes-devtools/luajit/luajit_2.1.0.bb new file +10 -0
+"
+FILES_${PN}-dev += "${libdir}/libluajit-5.1.a \
+    ${libdir}/libluajit-5.1.so \
+    ${libdir}/pkgconfig/luajit.pc \
+"
+FILES_luajit-common = "${datadir}/${BPN}-${PV}"
+
+# mips64 is not supported in this release
+COMPATIBLE_HOST_mipsarchn32 = "null"
+COMPATIBLE_HOST_mipsarchn64 = "null"

sync this with latest changes to 5.0.4 recipe there are more arches where it is not ported yet.

Also delete the old recipe in the same patch.

Quoted 1 line
author
#6 lore raw

PATCH 3/4 BCC: Add build recipe

In reply to Leo Yan

From: Sumit Garg <[email protected]>

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.

---
 ...-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
meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch new file +32 -0
new file mode 100644
index 000000000..b5acadc1b
@@ -0,0 +1,32 @@
+From 93cf25ba663e68a6a6f4237fbe0ef8349b3f37ef Mon Sep 17 00:00:00 2001
+From: Sumit Garg <[email protected]>
+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 <[email protected]>
+---
+ 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
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +37 -0
new file mode 100644
index 000000000..687fb64c7
@@ -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"
Signature · 1 line
2.17.1
#7 lore raw

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

Quoted 73 lines · Leo Yan

From: Sumit Garg <[email protected]>

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.

---
 ...-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
meta-oe/recipes-devtools/bcc/bcc/0001-Allow-to-build-with-OE-LLVM-cross-compiled-package.patch new file +32 -0
new file mode 100644
index 000000000..b5acadc1b
@@ -0,0 +1,32 @@
+From 93cf25ba663e68a6a6f4237fbe0ef8349b3f37ef Mon Sep 17 00:00:00 2001
+From: Sumit Garg <[email protected]>
+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 <[email protected]>
+---
+ 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
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +6 -0
new file mode 100644
index 000000000..687fb64c7
@@ -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 \

meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb line 16

Quoted 10 lines
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +10 -0
+            ninja-native \
+            elfutils-native \
+            flex-native \
+            ${MLPREFIX}elfutils \
+            ${MLPREFIX}binutils \
+            ${MLPREFIX}flex \
+            luajit \
+            clang \
+            "
+

this will add meta-clang dependency directly into meta-oe, which is not desired is it possible to make it optional or perhaps marked when meta-clang is not in BBLAYERS

Quoted 29 lines
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +21 -1
+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

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

author
#8 lore raw

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

Hi Khem,

On Mon, Feb 17, 2020 at 10:30:46PM -0800, Khem Raj wrote:

[...]

Quoted 7 lines
Quoted 7 lines
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +7 -0
+DEPENDS += "bison-native \
+            ninja-native \
+            elfutils-native \
+            flex-native \
+            ${MLPREFIX}elfutils \
+            ${MLPREFIX}binutils \
+            ${MLPREFIX}flex \
Quoted 8 lines

meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb line 16

Quoted 4 lines
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +4 -0
+            luajit \
+            clang \
+            "
+

this will add meta-clang dependency directly into meta-oe, which is not desired is it possible to make it optional or perhaps marked when meta-clang is not in BBLAYERS

Thanks a lot for reviewing. clang is mandotory for BCC to compile eBPF programs, so I think we cannot build clang as optional for BCC.

For marking the recipe when meta-clang is not in BBLAYERS, I searched with google but seems 'LAYERDEPENDS' and 'BBMASK' both are not suitable for this case. Could you give more detailed info for how to do this?

Thanks,
Leo

author
#9 lore raw

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

Hi Khem,

Quoted 22 lines · Leo Yan

Hi Khem,

On Mon, Feb 17, 2020 at 10:30:46PM -0800, Khem Raj wrote:

[...]

Quoted 7 lines
Quoted 7 lines
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +7 -0
+DEPENDS += "bison-native \
+            ninja-native \
+            elfutils-native \
+            flex-native \
+            ${MLPREFIX}elfutils \
+            ${MLPREFIX}binutils \
+            ${MLPREFIX}flex \
Quoted 8 lines

meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb line 16

Quoted 4 lines
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +4 -0
+            luajit \
+            clang \
+            "
+

this will add meta-clang dependency directly into meta-oe, which is not desired is it possible to make it optional or perhaps marked when meta-clang is not in BBLAYERS

Quoted 6 lines

Thanks a lot for reviewing. clang is mandotory for BCC to compile eBPF programs, so I think we cannot build clang as optional for BCC.

For marking the recipe when meta-clang is not in BBLAYERS, I searched with google but seems 'LAYERDEPENDS' and 'BBMASK' both are not suitable for this case. Could you give more detailed info for how to do this?

Just want to ask a following question.

Since BCC and bpftrace both are heavily relying on LLVM/Clang for their tracing, do you think it's a good idea to merge BCC and bpftrace into meta-clang layer, e.g. place into /meta-clang/recipes-devtools/? If so, we can easily resolve the dependency issue and avoid to introduce mess between meta-oe and meta-clang.

For the tool ply, it's simple and doesn't depend on Clang. So should keep it into meta-oe/recipes-devtools/ folder? Also welcome any suggestion for this.

Thanks,
Leo Yan

#10 lore raw

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

Quoted 41 lines · Leo Yan

Hi Khem,

Quoted 22 lines · Leo Yan

Hi Khem,

On Mon, Feb 17, 2020 at 10:30:46PM -0800, Khem Raj wrote:

[...]

Quoted 7 lines
Quoted 7 lines
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +7 -0
+DEPENDS += "bison-native \
+            ninja-native \
+            elfutils-native \
+            flex-native \
+            ${MLPREFIX}elfutils \
+            ${MLPREFIX}binutils \
+            ${MLPREFIX}flex \
Quoted 8 lines

meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb line 16

Quoted 4 lines
meta-oe/recipes-devtools/bcc/bcc_0.12.0.bb new file +4 -0
+            luajit \
+            clang \
+            "
+

this will add meta-clang dependency directly into meta-oe, which is not desired is it possible to make it optional or perhaps marked when meta-clang is not in BBLAYERS

Quoted 6 lines

Thanks a lot for reviewing. clang is mandotory for BCC to compile eBPF programs, so I think we cannot build clang as optional for BCC.

For marking the recipe when meta-clang is not in BBLAYERS, I searched with google but seems 'LAYERDEPENDS' and 'BBMASK' both are not suitable for this case. Could you give more detailed info for how to do this?

Just want to ask a following question.

Since BCC and bpftrace both are heavily relying on LLVM/Clang for their tracing, do you think it's a good idea to merge BCC and bpftrace into meta-clang layer, e.g. place into /meta-clang/recipes-devtools/? If so, we can easily resolve the dependency issue and avoid to introduce mess between meta-oe and meta-clang.

Quoted 3 lines

For the tool ply, it's simple and doesn't depend on Clang. So should keep it into meta-oe/recipes-devtools/ folder? Also welcome any suggestion for this.

Yeah I think thats a fine suggestion. meta-clang is good for it.

Quoted 3 lines

Thanks,
Leo Yan

author
#11 lore raw

PATCH 4/4 bpftrace: Add build recipe

In reply to Leo Yan

From: Sumit Garg <[email protected]>

bpftrace is a high-level tracing language for eBPF, its language is inspired by awk and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was created by Alastair Robertson. bpftrace language supports the usages for one-liner and script, it's very powerful for tracing and profiling. bpftrace internal mechanism depends on BCC and LLVM/Clang, so the building dependency has contains these modules.

Add recipe for bpftrace version 0.9.4. 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.

---
 ...ith-OE-llvm-clang-cross-compiled-pac.patch | 65 +++++++++++++++++++
 .../bpftrace/bpftrace_0.9.4.bb                | 34 ++++++++++
 2 files changed, 99 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/bpftrace/bpftrace/0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch
 create mode 100644 meta-oe/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
meta-oe/recipes-devtools/bpftrace/bpftrace/0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch new file +65 -0
new file mode 100644
index 000000000..d6cb32222
@@ -0,0 +1,65 @@
+From cdfd9284c7e83b1bd18c94c0f39c020f31759178 Mon Sep 17 00:00:00 2001
+From: Sumit Garg <[email protected]>
+Date: Mon, 17 Feb 2020 09:45:38 +0000
+Subject: [PATCH] Allow to build with OE llvm & clang cross compiled packages
+
+The default llvm and clang cmake packages 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
+or clang tools.
+
+So instead of looking for a complete llvm & clang packages, look for
+libraries and headers which are installed in target sysroot-recipe path.
+
+Also, fix name for clang library lookup.
+
+Signed-off-by: Sumit Garg <[email protected]>
+---
+ CMakeLists.txt         | 6 +++---
+ src/ast/CMakeLists.txt | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b766669..e4de1e3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,7 +14,7 @@ set(STATIC_LIBC OFF CACHE BOOL "Attempt to embed libc, only known to work with m
+ set(EMBED_LLVM OFF CACHE BOOL "Build LLVM static libs as an ExternalProject and link to these instead of system libs.")
+ set(EMBED_CLANG OFF CACHE BOOL "Build Clang static libs as an ExternalProject and link to these instead of system libs.")
+ set(EMBED_LIBCLANG_ONLY OFF CACHE BOOL "Build only libclang.a, and link to system libraries statically")
+-set(LLVM_VERSION "8" CACHE STRING "Embedded LLVM/Clang version to build and link against.")
++set(LLVM_VERSION "9" CACHE STRING "Embedded LLVM/Clang version to build and link against.")
+ set(BUILD_ASAN OFF CACHE BOOL "Build bpftrace with -fsanitize=address")
+
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+@@ -122,7 +122,7 @@ check_include_file("sys/sdt.h" HAVE_SYSTEMTAP_SYS_SDT_H)
+
+ if (EMBED_LLVM)
+   include(embed_llvm)
+-else()
++elseif(0)
+   # Some users have multiple versions of llvm installed and would like to specify
+   # a specific llvm version.
+   if(${LLVM_REQUESTED_VERSION})
+@@ -142,7 +142,7 @@ endif()
+
+ if(EMBED_CLANG)
+   include(embed_clang)
+-else()
++elseif(0)
+   find_package(Clang REQUIRED)
+   include_directories(SYSTEM ${CLANG_INCLUDE_DIRS})
+ endif()
+diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt
+index f280f47..f8b9dff 100644
+--- a/src/ast/CMakeLists.txt
++++ b/src/ast/CMakeLists.txt
+@@ -57,5 +57,5 @@ else()
+     llvm_expand_dependencies(llvm_libs ${_llvm_libs})
+     target_link_libraries(ast ${llvm_libs})
+   endif()
+-  target_link_libraries(ast libclang)
++  target_link_libraries(ast clang)
+ endif()
+--
+2.17.1
meta-oe/recipes-devtools/bpftrace/bpftrace_0.9.4.bb new file +34 -0
new file mode 100644
index 000000000..32a8b0baf
@@ -0,0 +1,34 @@
+SUMMARY = "bpftrace"
+HOMEPAGE = "https://github.com/iovisor/bpftrace"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+DEPENDS += "bison-native \
+            ninja-native \
+            elfutils-native \
+            flex-native \
+            gtest-native \
+            git-native \
+            ${MLPREFIX}elfutils \
+            ${MLPREFIX}binutils \
+            ${MLPREFIX}flex \
+            clang \
+            bcc \
+            "
+
+RDEPENDS_${PN} += "bash python3"
+
+SRC_URI = "git://github.com/iovisor/bpftrace \
+           file://0001-Allow-to-build-with-OE-llvm-clang-cross-compiled-pac.patch \
+           "
+SRCREV = "85f9eea624c83443816e37654d0c1c93366a2e66"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH"
+
+EXTRA_OECMAKE = " \
+    -DCMAKE_BUILD_TYPE=Release \
+"
Signature · 1 line
2.17.1