From 37f1ecc9fdec8bcf7e8db6496f9f00a00fa3e082 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 25 Mar 2026 00:37:35 -0700 Subject: bcc: Upgrade to 0.36.1 * Drop upstreamed patches * Backport clang-22 fix * Disable git lfs Signed-off-by: Khem Raj --- ...001-Fix-a-build-failure-with-clang21-5369.patch | 50 ----------- .../bcc/bcc/0001-Fix-build-with-LLVM-22.patch | 61 ++++++++++++++ .../recipes-devtools/bcc/bcc/fix_for_memleak.patch | 16 ---- .../meta-python/recipes-devtools/bcc/bcc_0.35.0.bb | 98 ---------------------- .../meta-python/recipes-devtools/bcc/bcc_0.36.1.bb | 97 +++++++++++++++++++++ 5 files changed, 158 insertions(+), 164 deletions(-) delete mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Fix-a-build-failure-with-clang21-5369.patch create mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Fix-build-with-LLVM-22.patch delete mode 100644 meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch delete 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/bcc/bcc_0.36.1.bb diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Fix-a-build-failure-with-clang21-5369.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Fix-a-build-failure-with-clang21-5369.patch deleted file mode 100644 index 571b496f71..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Fix-a-build-failure-with-clang21-5369.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 2e3997121af597f3a54d97505a38b7fdb9febae3 Mon Sep 17 00:00:00 2001 -From: yonghong-song -Date: Mon, 14 Jul 2025 20:21:59 -0700 -Subject: [PATCH] Fix a build failure with clang21 (#5369) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The build error message: - src/cc/frontends/clang/loader.cc:400:73: error: no matching function for - call to ‘clang::TextDiagnosticPrinter::TextDiagnosticPrinter( - llvm::raw_fd_ostream&, clang::DiagnosticOptions*)’ - 400 | auto diag_client = new TextDiagnosticPrinter(llvm::errs(), &*diag_opts); - | ^ -The llvm commit - https://github.com/llvm/llvm-project/pull/139584 -caused the build failure. - -Adjust the code properly and the error is fixed. - -Upstream-Status: Backport [https://github.com/iovisor/bcc/commit/8c5c96ad3beeed2fa827017f451a952306826974] -Signed-off-by: Khem Raj ---- - src/cc/frontends/clang/loader.cc | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/cc/frontends/clang/loader.cc b/src/cc/frontends/clang/loader.cc -index 07dc9d6a..6f8387aa 100644 ---- a/src/cc/frontends/clang/loader.cc -+++ b/src/cc/frontends/clang/loader.cc -@@ -396,11 +396,19 @@ int ClangLoader::do_compile( - flags_cstr_rem.end()); - - // set up the error reporting class -+#if LLVM_VERSION_MAJOR >= 21 -+ DiagnosticOptions diag_opts; -+ auto diag_client = new TextDiagnosticPrinter(llvm::errs(), diag_opts); -+ -+ IntrusiveRefCntPtr DiagID(new DiagnosticIDs()); -+ DiagnosticsEngine diags(DiagID, diag_opts, diag_client); -+#else - IntrusiveRefCntPtr diag_opts(new DiagnosticOptions()); - auto diag_client = new TextDiagnosticPrinter(llvm::errs(), &*diag_opts); - - IntrusiveRefCntPtr DiagID(new DiagnosticIDs()); - DiagnosticsEngine diags(DiagID, &*diag_opts, diag_client); -+#endif - - // set up the command line argument wrapper - diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Fix-build-with-LLVM-22.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Fix-build-with-LLVM-22.patch new file mode 100644 index 0000000000..19f0a6ccb4 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/0001-Fix-build-with-LLVM-22.patch @@ -0,0 +1,61 @@ +From 4c7be1ec6ab74e973f8d18a9011fa349c3d9dd58 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= +Date: Mon, 2 Mar 2026 10:03:15 +0100 +Subject: [PATCH] Fix build with LLVM-22 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +LLVM-22 changed the signatures of various createDiagnostics() calls [1]. +Introduce a new version macro guard and adapt the code to the changed API. + +Fixes #5483 + +[1] https://github.com/llvm/llvm-project/commit/30633f30894129919050f24fdd1f8f6bc46beae0 + +Upstream-Status: Backport [https://github.com/iovisor/bcc/commit/4c7be1ec6ab74e973f8d18a9011fa349c3d9dd58] +Signed-off-by: Holger Hoffstätte +--- + src/cc/frontends/clang/loader.cc | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/cc/frontends/clang/loader.cc b/src/cc/frontends/clang/loader.cc +index 6f8387aa..1f706344 100644 +--- a/src/cc/frontends/clang/loader.cc ++++ b/src/cc/frontends/clang/loader.cc +@@ -464,7 +464,10 @@ int ClangLoader::do_compile( + } + invocation0.getFrontendOpts().DisableFree = false; + +-#if LLVM_VERSION_MAJOR >= 20 ++#if LLVM_VERSION_MAJOR >= 22 ++ compiler0.setVirtualFileSystem(llvm::vfs::getRealFileSystem()); ++ compiler0.createDiagnostics(new IgnoringDiagConsumer()); ++#elif LLVM_VERSION_MAJOR >= 20 + compiler0.createDiagnostics(*llvm::vfs::getRealFileSystem(), new IgnoringDiagConsumer()); + #else + compiler0.createDiagnostics(new IgnoringDiagConsumer()); +@@ -487,7 +490,10 @@ int ClangLoader::do_compile( + add_main_input(invocation1, main_path, &*out_buf); + invocation1.getFrontendOpts().DisableFree = false; + +-#if LLVM_VERSION_MAJOR >= 20 ++#if LLVM_VERSION_MAJOR >= 22 ++ compiler1.setVirtualFileSystem(llvm::vfs::getRealFileSystem()); ++ compiler1.createDiagnostics(); ++#elif LLVM_VERSION_MAJOR >= 20 + compiler1.createDiagnostics(*llvm::vfs::getRealFileSystem()); + #else + compiler1.createDiagnostics(); +@@ -517,7 +523,10 @@ int ClangLoader::do_compile( + invocation2.getCodeGenOpts().setInlining(CodeGenOptions::NormalInlining); + // suppress warnings in the 2nd pass, but bail out on errors (our fault) + invocation2.getDiagnosticOpts().IgnoreWarnings = true; +-#if LLVM_VERSION_MAJOR >= 20 ++#if LLVM_VERSION_MAJOR >= 22 ++ compiler2.setVirtualFileSystem(llvm::vfs::getRealFileSystem()); ++ compiler2.createDiagnostics(); ++#elif LLVM_VERSION_MAJOR >= 20 + compiler2.createDiagnostics(*llvm::vfs::getRealFileSystem()); + #else + compiler2.createDiagnostics(); diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch deleted file mode 100644 index a3a1ec931d..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc/fix_for_memleak.patch +++ /dev/null @@ -1,16 +0,0 @@ -Upstream-Status: Submitted [https://github.com/iovisor/bcc/pull/5355] -Signed-off-by: Harish Sadineni - -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: - diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb deleted file mode 100644 index 6e821cca7a..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.35.0.bb +++ /dev/null @@ -1,98 +0,0 @@ -SUMMARY = "BPF Compiler Collection (BCC)" -HOMEPAGE = "https://github.com/iovisor/bcc" -LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e" - -inherit cmake python3native manpages ptest - -DEPENDS += "bison-native \ - flex-native \ - zip-native \ - flex \ - elfutils \ - clang \ - libbpf \ - python3-setuptools-native \ - xz \ - " - -RDEPENDS:${PN} += "bash python3 python3-core python3-setuptools xz" -RDEPENDS:${PN}-ptest = "kernel-devsrc packagegroup-core-buildessential cmake bash python3 python3-netaddr python3-pyroute2" - -SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https;tag=v${PV} \ - file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \ - file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \ - file://0001-Fix-a-build-failure-with-clang21-5369.patch \ - file://0001-Add-ARM64-syscall-prefix-detection-in-C-API.patch \ - file://0002-Add-riscv-syscall-prefix-detection-in-C-API.patch \ - file://0003-folly-tracing-Remove-x86-specific-naming-from-tracin.patch \ - file://0004-folly-tracing-Add-ARM-and-AArch64-support-to-static-.patch \ - file://run-ptest \ - file://ptest_wrapper.sh \ - file://fix_for_memleak.patch \ - " - -SRCREV = "c31a1ca305f787ba53e001ead45ebf65233a32cf" - -PACKAGECONFIG ??= "examples" -PACKAGECONFIG:remove:libc-musl = "examples" - -PACKAGECONFIG[manpages] = "-DENABLE_MAN=ON,-DENABLE_MAN=OFF," -PACKAGECONFIG[examples] = "-DENABLE_EXAMPLES=ON,-DENABLE_EXAMPLES=OFF," - -EXTRA_OECMAKE = " \ - -DREVISION='${PV}' \ - -DCMAKE_USE_LIBBPF_PACKAGE=ON \ - -DENABLE_LLVM_SHARED=ON \ - -DENABLE_CLANG_JIT=ON \ - -DPY_SKIP_DEB_LAYOUT=ON \ - -DPYTHON_CMD=${PYTHON} \ - -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \ -" - -# Avoid stripping debuginfo.so to fix some tests. -INHIBIT_PACKAGE_STRIP = "1" -INHIBIT_PACKAGE_DEBUG_SPLIT = "1" - -do_install:append() { - sed -e 's@#!/usr/bin/env python@#!/usr/bin/env python3@g' \ - -i $(find ${D}${datadir}/${PN} -type f) - sed -e 's@#!/usr/bin/python.*@#!/usr/bin/env python3@g' \ - -i $(find ${D}${datadir}/${PN} -type f) - rm -rf ${D}${datadir}/bcc/examples/lua -} - -do_install_ptest() { - install -d ${D}${PTEST_PATH}/tests/cc - # ptest searches for shared libs and archive files in the build folder. - # Hence, these files are copied to the image to fix these tests. - install -d ${D}${B}/tests/cc - install ${B}/tests/cc/archive.zip ${B}/tests/cc/libdebuginfo_test_lib.so ${B}/tests/cc/with_gnu_debuglink.so ${B}/tests/cc/with_gnu_debugdata.so ${B}/tests/cc/debuginfo.so ${D}${B}/tests/cc - install -d ${D}/opt - install ${B}/tests/cc/test_libbcc_no_libbpf ${B}/tests/cc/libusdt_test_lib.so ${D}${PTEST_PATH}/tests/cc - cp -rf ${S}/tests/python ${D}${PTEST_PATH}/tests/python - install ${UNPACKDIR}/ptest_wrapper.sh ${D}${PTEST_PATH}/tests - install ${S}/examples/networking/simulation.py ${D}${PTEST_PATH}/tests/python - find ${S}/tools/ -type f -name "*.py" -exec \ - sed -i \ - -e 's@^#! */usr/bin/env python$@#!/usr/bin/env python3@' \ - -e 's@^#! */usr/bin/python.*@#!/usr/bin/env python3@' {} + - cp -rf ${S}/tools/ ${D}${PTEST_PATH}/../../tools/ -} - -FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" -FILES:${PN} += "${B}/tests/cc" -FILES:${PN}-ptest += "${libdir}/libbcc.so" -FILES:${PN}-ptest += "${libdir}/tools/" -FILES:${PN}-ptest += "/opt/" -FILES:${PN}-doc += "${datadir}/${PN}/man" - -COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" - -# WARNING: bcc-0.30.0+git-r0 do_package_qa: QA Issue: File /usr/lib/bcc/ptest/tests/cc/test_libbcc_no_libbpf in package bcc-ptest contains reference to TMPDIR [buildpaths] -# this one is difficult to resolve, because the tests use CMAKE_CURRENT_BINARY_DIR directly in .cc e.g.: -# https://github.com/iovisor/bcc/commit/7271bfc946a19413761be2e3c60c48bf72c5eea1#diff-233a0bfa490f3d7466c49935b64c86dd93956bbc0461f5af703b344cf6601461 -# we would probably need to use separate variable for "runtime" path for test assets from the standard CMAKE_CURRENT_BINARY_DIR variable or use relative -# path from the test binary -WARN_QA:append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' buildpaths', '', d)}" -ERROR_QA:remove = "${@bb.utils.contains('PTEST_ENABLED', '1', 'buildpaths', '', d)}" diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.36.1.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.36.1.bb new file mode 100644 index 0000000000..0d8bee5da4 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/bcc/bcc_0.36.1.bb @@ -0,0 +1,97 @@ +SUMMARY = "BPF Compiler Collection (BCC)" +HOMEPAGE = "https://github.com/iovisor/bcc" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e" + +inherit cmake python3native manpages ptest + +DEPENDS += "bison-native \ + flex-native \ + zip-native \ + flex \ + elfutils \ + clang \ + libbpf \ + python3-setuptools-native \ + xz \ + " + +RDEPENDS:${PN} += "bash python3 python3-core python3-setuptools xz" +RDEPENDS:${PN}-ptest = "kernel-devsrc packagegroup-core-buildessential cmake bash python3 python3-netaddr python3-pyroute2" + +SRC_URI = "gitsm://github.com/iovisor/bcc;branch=master;protocol=https;lfs=0;tag=v${PV} \ + file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \ + file://0001-Vendor-just-enough-extra-headers-to-allow-libbpf-to-.patch \ + file://0001-Add-ARM64-syscall-prefix-detection-in-C-API.patch \ + file://0002-Add-riscv-syscall-prefix-detection-in-C-API.patch \ + file://0003-folly-tracing-Remove-x86-specific-naming-from-tracin.patch \ + file://0004-folly-tracing-Add-ARM-and-AArch64-support-to-static-.patch \ + file://0001-Fix-build-with-LLVM-22.patch \ + file://run-ptest \ + file://ptest_wrapper.sh \ + " + +SRCREV = "b9f1b2ab025e3ac95b6aaa1cb20bf222a7b8804e" + +PACKAGECONFIG ??= "examples" +PACKAGECONFIG:remove:libc-musl = "examples" + +PACKAGECONFIG[manpages] = "-DENABLE_MAN=ON,-DENABLE_MAN=OFF," +PACKAGECONFIG[examples] = "-DENABLE_EXAMPLES=ON,-DENABLE_EXAMPLES=OFF," + +EXTRA_OECMAKE = " \ + -DREVISION='${PV}' \ + -DCMAKE_USE_LIBBPF_PACKAGE=ON \ + -DENABLE_LLVM_SHARED=ON \ + -DENABLE_CLANG_JIT=ON \ + -DPY_SKIP_DEB_LAYOUT=ON \ + -DPYTHON_CMD=${PYTHON} \ + -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \ +" + +# Avoid stripping debuginfo.so to fix some tests. +INHIBIT_PACKAGE_STRIP = "1" +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" + +do_install:append() { + sed -e 's@#!/usr/bin/env python@#!/usr/bin/env python3@g' \ + -i $(find ${D}${datadir}/${PN} -type f) + sed -e 's@#!/usr/bin/python.*@#!/usr/bin/env python3@g' \ + -i $(find ${D}${datadir}/${PN} -type f) + rm -rf ${D}${datadir}/bcc/examples/lua +} + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/tests/cc + # ptest searches for shared libs and archive files in the build folder. + # Hence, these files are copied to the image to fix these tests. + install -d ${D}${B}/tests/cc + install ${B}/tests/cc/archive.zip ${B}/tests/cc/libdebuginfo_test_lib.so ${B}/tests/cc/with_gnu_debuglink.so ${B}/tests/cc/with_gnu_debugdata.so ${B}/tests/cc/debuginfo.so ${D}${B}/tests/cc + install -d ${D}/opt + install ${B}/tests/cc/test_libbcc_no_libbpf ${B}/tests/cc/libusdt_test_lib.so ${D}${PTEST_PATH}/tests/cc + cp -rf ${S}/tests/python ${D}${PTEST_PATH}/tests/python + install ${UNPACKDIR}/ptest_wrapper.sh ${D}${PTEST_PATH}/tests + install ${S}/examples/networking/simulation.py ${D}${PTEST_PATH}/tests/python + find ${S}/tools/ -type f -name "*.py" -exec \ + sed -i \ + -e 's@^#! */usr/bin/env python$@#!/usr/bin/env python3@' \ + -e 's@^#! */usr/bin/python.*@#!/usr/bin/env python3@' {} + + cp -rf ${S}/tools/ ${D}${PTEST_PATH}/../../tools/ +} + +FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" +FILES:${PN} += "${B}/tests/cc" +FILES:${PN}-ptest += "${libdir}/libbcc.so" +FILES:${PN}-ptest += "${libdir}/tools/" +FILES:${PN}-ptest += "/opt/" +FILES:${PN}-doc += "${datadir}/${PN}/man" + +COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*|riscv64.*)-linux" + +# WARNING: bcc-0.30.0+git-r0 do_package_qa: QA Issue: File /usr/lib/bcc/ptest/tests/cc/test_libbcc_no_libbpf in package bcc-ptest contains reference to TMPDIR [buildpaths] +# this one is difficult to resolve, because the tests use CMAKE_CURRENT_BINARY_DIR directly in .cc e.g.: +# https://github.com/iovisor/bcc/commit/7271bfc946a19413761be2e3c60c48bf72c5eea1#diff-233a0bfa490f3d7466c49935b64c86dd93956bbc0461f5af703b344cf6601461 +# we would probably need to use separate variable for "runtime" path for test assets from the standard CMAKE_CURRENT_BINARY_DIR variable or use relative +# path from the test binary +WARN_QA:append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' buildpaths', '', d)}" +ERROR_QA:remove = "${@bb.utils.contains('PTEST_ENABLED', '1', 'buildpaths', '', d)}" -- cgit v1.2.3-54-g00ecf