Skip to contentSkip to conversation

bpftrace,bcc: Migrate recipe from meta-clang to meta-oe

PATCH New Khem Raj 1 participant 3 messages Jul 16, 2025

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/3 bpftrace,bcc: Migrate recipe from meta-clang to meta-oe

These recipes depend on clang, and clang being on core it is better place for these tools to be in a common layer for now that is meta-oe

---
 ...ists.txt-override-the-PY_CMD_ESCAPED.patch |  41 ++++++
 ...gh-extra-headers-to-allow-libbpf-to-.patch | 124 ++++++++++++++++++
 .../bcc/bcc/fix_for_memleak.patch             |  16 +++
 .../recipes-devtools/bcc/bcc/ptest_wrapper.sh |  16 +++
 .../recipes-devtools/bcc/bcc/run-ptest        |  65 +++++++++
 .../recipes-devtools/bcc/bcc_0.35.0.bb        |  92 +++++++++++++
 ...-failures-due-to-missing-location.hh.patch |  54 ++++++++
 ....txt-allow-to-set-BISON_FLAGS-like-l.patch |  38 ++++++
 .../bpftrace/bpftrace/run-ptest               |  51 +++++++
 .../bpftrace/bpftrace_0.23.0.bb               |  62 +++++++++
 10 files changed, 559 insertions(+)
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/ptest_wrapper.sh
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/run-ptest
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Fix-build-failures-due-to-missing-location.hh.patch
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest
 create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.23.0.bb
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch new file +41 -0
new file mode 100644
index 0000000000..1f9c41dfab
@@ -0,0 +1,41 @@
+From 4f64ed40e1ffea7ea278627f30a01018e57dcbcf Mon Sep 17 00:00:00 2001
+From: Mingli Yu <[email protected]>
+Date: Wed, 9 Sep 2020 05:48:19 +0000
+Subject: [PATCH] CMakeLists.txt: override the PY_CMD_ESCAPED
+
+Override the PY_CMD_ESCAPED as the PY_CMD_ESCAPED is constructed by
+the full path of the python3. In some cases, the path is so long and
+result in the PY_CMD_ESCAPED exceeds 255 characters and comes below
+do_configure error:
+ | CMake Error at src/python/CMakeLists.txt:18 (configure_file):
+ |   configure_file Problem configuring file
+ |
+ | CMake Error: Could not open file for write in copy operation /buildarea1/test/wr_build/wr1020_20200909_bcc/bcc_long_Kernel/auto-standalone_next/200827/lxbuilds/Intel-Snow-Ridge-NS_platform_up/intel-x86-64-standard-glibc-std/wrlinux/build/tmp-glibc/work/corei7-64-wrs-linux/bcc/0.15.0-r0/build/src/python/bcc--buildarea1-test-wr_build-wr1020_20200909_bcc-bcc_long_Kernel-auto-standalone_next-200827-lxbuilds-Intel-Snow-Ridge-NS_platform_up-intel-x86-64-standard-glibc-std-wrlinux-build-tmp-glibc-work-corei7-64-wrs-linux-bcc-0.15.0-r0-recipe-sysroot-native-usr-bin-python3-native-python3/bcc/version.py.tmp
+
+Upstream-Status: Pending
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ src/python/CMakeLists.txt | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/src/python/CMakeLists.txt
++++ b/src/python/CMakeLists.txt
+@@ -16,7 +16,7 @@ file(GLOB_RECURSE PYTHON_INCLUDES RELATI
+ 
+ foreach(PY_CMD ${PYTHON_CMD})
+   string(REPLACE "/" "-" PY_CMD_ESCAPED ${PY_CMD})
+-  set(PY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bcc-${PY_CMD_ESCAPED})
++  set(PY_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bcc-python3)
+ 
+   foreach(PY_SRC ${PYTHON_SOURCES})
+     configure_file(${PY_SRC} ${PY_DIRECTORY}/${PY_SRC} COPYONLY)
+@@ -35,7 +35,7 @@ foreach(PY_CMD ${PYTHON_CMD})
+     DEPENDS ${PYTHON_SOURCES} ${PYTHON_INCLUDES}
+     COMMENT "Building sdist for ${PY_CMD}"
+   )
+-  add_custom_target(bcc_py_${PY_CMD_ESCAPED} ALL DEPENDS ${PIP_INSTALLABLE})
++  add_custom_target(bcc_py_python3 ALL DEPENDS ${PIP_INSTALLABLE})
+ 
+   if(NOT PYTHON_PREFIX)
+      set(PYTHON_PREFIX ${CMAKE_INSTALL_PREFIX})
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch new file +124 -0

124 lines not on this page · raw message

meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch new file +16 -0
new file mode 100644
index 0000000000..a3a1ec931d
@@ -0,0 +1,16 @@
+Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/5355]
+Signed-off-by: Harish Sadineni <[email protected]>
+
+diff --git a/tests/python/test_tools_memleak.py b/tests/python/test_tools_memleak.py
+--- a/tests/python/test_tools_memleak.py       
++++ b/tests/python/test_tools_memleak.py   
+@@ -26,7 +26,7 @@
+     # Build the memory leaking application.
+     c_src = 'test_tools_memleak_leaker_app.c'
+     tmp_dir = tempfile.mkdtemp(prefix='bcc-test-memleak-')
+-    c_src_full = os.path.dirname(sys.argv[0]) + os.path.sep + c_src
++    c_src_full = os.path.abspath(os.path.dirname(sys.argv[0])) + os.path.sep + c_src
+     exec_dst = tmp_dir + os.path.sep + 'leaker_app'
+
+     if subprocess.call(['gcc', '-g', '-O0', '-o', exec_dst, c_src_full]) != 0:
+
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/ptest_wrapper.sh new file +16 -0
new file mode 100644
index 0000000000..92d015614c
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Simple OE specific wrapper for bcc python tests
+
+name=$1
+kind=$2
+cmd=$3
+shift 3
+
+case $kind in
+    simple|sudo)
+        $cmd "$@"
+        ;;
+    *)
+        echo "Invalid kind $kind of test $name"
+        exit 1
+esac
meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/run-ptest new file +65 -0

65 lines not on this page · raw message

meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb new file +92 -0

92 lines not on this page · raw message

meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0001-Fix-build-failures-due-to-missing-location.hh.patch new file +54 -0

54 lines not on this page · raw message

meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/0002-CMakeLists.txt-allow-to-set-BISON_FLAGS-like-l.patch new file +38 -0
new file mode 100644
index 0000000000..4f0ebbf564
@@ -0,0 +1,38 @@
+From ce5d908bb1256ede680fbfd521f087060a567dca Mon Sep 17 00:00:00 2001
+From: Martin Jansa <[email protected]>
+Date: Tue, 3 Sep 2024 14:17:51 +0200
+Subject: [PATCH] CMakeLists.txt: allow to set BISON_FLAGS like -l
+
+Signed-off-by: Martin Jansa <[email protected]>
+
+Upstream-Status: Pending
+---
+ CMakeLists.txt | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -100,16 +100,20 @@ include_directories(SYSTEM ${LIBCEREAL_I
+ 
+ find_package(BISON REQUIRED)
+ find_package(FLEX REQUIRED)
++
++# avoid buildpaths in generated #line statements and allow to pass --file-prefix-map=OLD=NEW
++set(BISON_FLAGS "${BISON_FLAGS} -l")
++set(FLEX_FLAGS "${FLEX_FLAGS} -L")
+ # `parser_class_name` is deprecated and generates warnings in bison >= 3.3.
+ # But `api.parser.class` is not supported in bison < 3.3. So we must inject
+ # the %define based on the bison version here.
+ if(${BISON_VERSION} VERSION_GREATER_EQUAL 3.3)
+-  set(BISON_FLAGS "-Dapi.parser.class={Parser}")
++  set(BISON_FLAGS "${BISON_FLAGS} -Dapi.parser.class={Parser}")
+ else()
+-  set(BISON_FLAGS "-Dparser_class_name={Parser}")
++  set(BISON_FLAGS "${BISON_FLAGS} -Dparser_class_name={Parser}")
+ endif()
+ bison_target(bison_parser src/parser.yy ${CMAKE_BINARY_DIR}/parser.tab.cc COMPILE_FLAGS ${BISON_FLAGS} VERBOSE)
+-flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc)
++flex_target(flex_lexer src/lexer.l ${CMAKE_BINARY_DIR}/lex.yy.cc COMPILE_FLAGS ${FLEX_FLAGS})
+ add_flex_bison_dependency(flex_lexer bison_parser)
+ add_library(parser STATIC ${BISON_bison_parser_OUTPUTS} ${FLEX_flex_lexer_OUTPUTS})
+ target_compile_options(parser PRIVATE "-w")
meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace/run-ptest new file +51 -0

51 lines not on this page · raw message

meta-oe/dynamic-layers/meta-python/recipes-devtools/bpftrace/bpftrace_0.23.0.bb new file +62 -0

62 lines not on this page · raw message

author
#1 lore raw

PATCH 2/3 castxml: Add recipe from meta-clang

Moved the recipe to meta-oe

---
 meta-oe/recipes-devtools/castxml/castxml_0.6.11.bb | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/castxml/castxml_0.6.11.bb
meta-oe/recipes-devtools/castxml/castxml_0.6.11.bb new file +12 -0
new file mode 100644
index 0000000000..69663e01ab
@@ -0,0 +1,12 @@
+SUMMARY = "C-family abstract syntax tree XML output tool."
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRC_URI = "git://github.com/CastXML/CastXML;protocol=https;branch=master"
+
+SRCREV = "f38c024b395187814f14f77974d8f5240bb2e71f"
+
+DEPENDS = "clang"
+inherit cmake pkgconfig python3native
+
+BBCLASSEXTEND = "native nativesdk"
author
#2 lore raw

PATCH 3/3 include-what-you-use: Move the recipe here from meta-clang

In reply to Khem Raj

This recipe needs clang which is now in oe-core

---
 .../include-what-you-use_0.23.bb              | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/include-what-you-use/include-what-you-use_0.23.bb
meta-oe/recipes-devtools/include-what-you-use/include-what-you-use_0.23.bb new file +24 -0
new file mode 100644
index 0000000000..7c4392fdd1
@@ -0,0 +1,24 @@
+SUMMARY = "Include What You Use (IWYU) - Clang based checker for C/C++ header includes"
+DESCRIPTION = "For every symbol (type, function, variable, or macro) that you \
+               use in foo.cc (or foo.cpp), either foo.cc or foo.h should \
+               include a .h file that exports the declaration of that symbol."
+HOMEPAGE = "https://include-what-you-use.org"
+BUGTRACKER = "https://github.com/include-what-you-use/include-what-you-use/issues"
+LICENSE = "NCSA"
+LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=3bb66a14534286912cd6f26649b5c60a \
+                    file://iwyu-check-license-header.py;md5=7bdb749831163fbe9232b3cb7186116f"
+
+DEPENDS = "clang"
+
+SRC_URI = "git://github.com/include-what-you-use/include-what-you-use.git;protocol=https;branch=master"
+SRCREV = "fa1094c0b3848f82244778bc6153cc84f8a890f6"
+
+PV .= "+git"
+
+inherit cmake python3native
+
+EXTRA_OECMAKE = "-DIWYU_RESOURCE_RELATIVE_TO=iwyu"
+
+FILES:${PN} += "${datadir}/${BPN}"
+
+BBCLASSEXTEND = "nativesdk"