commit:     a25df75a741e95ee605320f9bb833473677563e9
Author:     Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
AuthorDate: Sat Dec  6 16:26:06 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec 27 17:14:31 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a25df75a

dev-util/bcc: fix build with LLVM-21

With llvm_slot_21 the build fails:

  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);
      |                                                                         
^
(etc.)

Add an upstream commit to fix this.

Closes: https://bugs.gentoo.org/968069
Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
Part-of: https://github.com/gentoo/gentoo/pull/44925
Closes: https://github.com/gentoo/gentoo/pull/44925
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/bcc/bcc-0.35.0-r2.ebuild          |  3 +-
 dev-util/bcc/files/bcc-0.35.0-llvm21.patch | 45 ++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/dev-util/bcc/bcc-0.35.0-r2.ebuild 
b/dev-util/bcc/bcc-0.35.0-r2.ebuild
index 22d7626f6ceb..e6f0bdf84b39 100644
--- a/dev-util/bcc/bcc-0.35.0-r2.ebuild
+++ b/dev-util/bcc/bcc-0.35.0-r2.ebuild
@@ -7,7 +7,7 @@ LUA_COMPAT=( luajit )
 DISTUTILS_OPTIONAL=1
 DISTUTILS_USE_PEP517=setuptools
 PYTHON_COMPAT=( python3_{{10..14},{13..14}t}  )
-LLVM_COMPAT=( {15..20} )
+LLVM_COMPAT=( {15..21} )
 
 inherit cmake linux-info llvm-r1 lua-single distutils-r1 toolchain-funcs
 
@@ -70,6 +70,7 @@ PATCHES=(
        "${FILESDIR}/bcc-0.25.0-cmakelists.patch"
        "${FILESDIR}/bcc-0.23.0-man-compress.patch"
        "${FILESDIR}/bcc-0.31.0-no-automagic-deps.patch"
+       "${FILESDIR}/bcc-0.35.0-llvm21.patch"
 )
 
 pkg_pretend() {

diff --git a/dev-util/bcc/files/bcc-0.35.0-llvm21.patch 
b/dev-util/bcc/files/bcc-0.35.0-llvm21.patch
new file mode 100644
index 000000000000..58df2c0d42f0
--- /dev/null
+++ b/dev-util/bcc/files/bcc-0.35.0-llvm21.patch
@@ -0,0 +1,45 @@
+From: 
https://github.com/iovisor/bcc/commit/8c5c96ad3beeed2fa827017f451a952306826974
+
+From: yonghong-song <[email protected]>
+Date: Mon, 14 Jul 2025 20:21:59 -0700
+Subject: [PATCH] Fix a build failure with clang21 (#5369)
+
+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.
+---
+ 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 07dc9d6ab019..6f8387aaf017 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<DiagnosticIDs> DiagID(new DiagnosticIDs());
++  DiagnosticsEngine diags(DiagID, diag_opts, diag_client);
++#else
+   IntrusiveRefCntPtr<DiagnosticOptions> diag_opts(new DiagnosticOptions());
+   auto diag_client = new TextDiagnosticPrinter(llvm::errs(), &*diag_opts);
+ 
+   IntrusiveRefCntPtr<DiagnosticIDs> DiagID(new DiagnosticIDs());
+   DiagnosticsEngine diags(DiagID, &*diag_opts, diag_client);
++#endif
+ 
+   // set up the command line argument wrapper
+ 

Reply via email to