#1122606 bpfcc ftbfs with LLVM 21

Package:
src:bpfcc
Source:
src:bpfcc
Submitter:
Matthias Klose
Date:
2026-01-03 20:37:02 UTC
Severity:
normal
Tags:
#1122606#5
Date:
2025-12-11 18:55:26 UTC
From:
To:
  ftbfs with LLVM 21:

[...]
[ 60%] Building CXX object
src/cc/CMakeFiles/bpf-static.dir/usdt/usdt_args.cc.o
cd /build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu/src/cc
&& /usr/bin/c++ -DEXPORT_USDT -DHAVE_EXTERNAL_LIBBPF -DHAVE_LIBLZMA
-I/usr/lib/llvm-21/include/../tools/clang/include 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src 
-I/build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu/src 
-I/build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu/src/cc 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src/cc 
-I/build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu/src/cc/frontends/b 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/b 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/clang 
-I/usr/lib/llvm-21/include 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/compat -g -O2 
-ffile-prefix-map=/build/reproducible-path/bpfcc-0.35.0+ds=. 
-fstack-protector-strong -fstack-clash-protection -Wformat 
-Werror=format-security -mbranch-protection=standard -Wdate-time 
-D_FORTIFY_SOURCE=2 -DCUSTOM_MACRO=true -Wall  -fno-rtti -fPIC 
-DBCC_PROG_TAG_DIR='"/var/tmp/bcc"' -Wno-unused-result -std=gnu++17 
-D_GNU_SOURCE -DEXPERIMENTAL_KEY_INSTRUCTIONS -D__STDC_CONSTANT_MACROS 
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -MD -MT 
src/cc/CMakeFiles/bpf-static.dir/usdt/usdt_args.cc.o -MF
CMakeFiles/bpf-static.dir/usdt/usdt_args.cc.o.d -o
CMakeFiles/bpf-static.dir/usdt/usdt_args.cc.o -c
/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/usdt/usdt_args.cc
/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/clang/loader.cc:
In member function ‘int
ebpf::ClangLoader::do_compile(std::unique_ptr<llvm::Module>*,
ebpf::TableStorage&, bool, const std::vector<const char*,
std::allocator<const char*> >&, const std::vector<const char*,
std::allocator<const char*> >&, const std::string&, const
std::unique_ptr<llvm::MemoryBuffer>&, const std::string&,
ebpf::ProgFuncInfo&, std::string&, bool, const std::string&,
ebpf::fake_fd_map_def&, std::map<std::__cxx11::basic_string<char>,
std::vector<std::__cxx11::basic_string<char> > >&)’:
/build/reproducible-path/bpfcc-0.35.0+ds/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);
       |
         ^
/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/clang/loader.cc:400:73:
note: there is 1 candidate
In file included from
/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/clang/loader.cc:47:
/usr/lib/llvm-21/include/clang/Frontend/TextDiagnosticPrinter.h:41:3:
note: candidate 1:
‘clang::TextDiagnosticPrinter::TextDiagnosticPrinter(llvm::raw_ostream&,
clang::DiagnosticOptions&, bool)’
    41 |   TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions
&DiagOpts,
       |   ^~~~~~~~~~~~~~~~~~~~~
/usr/lib/llvm-21/include/clang/Frontend/TextDiagnosticPrinter.h:41:61:
note: no known conversion for argument 2 from
‘clang::DiagnosticOptions*’ to ‘clang::DiagnosticOptions&’
    41 |   TextDiagnosticPrinter(raw_ostream &os, DiagnosticOptions
&DiagOpts,
       |
~~~~~~~~~~~~~~~~~~~^~~~~~~~
make[3]: Leaving directory
'/build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu'
[ 60%] Built target api-objects
[ 61%] Building CXX object
src/cc/CMakeFiles/bpf-shared.dir/usdt/usdt_args.cc.o
cd /build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu/src/cc
&& /usr/bin/c++ -DEXPORT_USDT -DHAVE_EXTERNAL_LIBBPF -DHAVE_LIBLZMA
-Dbpf_shared_EXPORTS -I/usr/lib/llvm-21/include/../tools/clang/include 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src 
-I/build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu/src 
-I/build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu/src/cc 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src/cc 
-I/build/reproducible-path/bpfcc-0.35.0+ds/obj-aarch64-linux-gnu/src/cc/frontends/b 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/b 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/clang 
-I/usr/lib/llvm-21/include 
-I/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/compat -g -O2 
-ffile-prefix-map=/build/reproducible-path/bpfcc-0.35.0+ds=. 
-fstack-protector-strong -fstack-clash-protection -Wformat 
-Werror=format-security -mbranch-protection=standard -Wdate-time 
-D_FORTIFY_SOURCE=2 -DCUSTOM_MACRO=true -Wall  -fno-rtti -fPIC 
-DBCC_PROG_TAG_DIR='"/var/tmp/bcc"' -Wno-unused-result -std=gnu++17 
-fPIC -D_GNU_SOURCE -DEXPERIMENTAL_KEY_INSTRUCTIONS 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-MD -MT src/cc/CMakeFiles/bpf-shared.dir/usdt/usdt_args.cc.o -MF 
CMakeFiles/bpf-shared.dir/usdt/usdt_args.cc.o.d -o
CMakeFiles/bpf-shared.dir/usdt/usdt_args.cc.o -c
/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/usdt/usdt_args.cc
In file included from /usr/lib/llvm-21/include/clang/Basic/FileManager.h:22,
                  from
/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/clang/loader.cc:35:
/usr/lib/llvm-21/include/llvm/ADT/IntrusiveRefCntPtr.h: In instantiation
of ‘static void llvm::IntrusiveRefCntPtrInfo<T>::retain(T*) [with T =
clang::DiagnosticOptions]’:
/usr/lib/llvm-21/include/llvm/ADT/IntrusiveRefCntPtr.h:228:40:
required from ‘void llvm::IntrusiveRefCntPtr<T>::retain() [with T =
clang::DiagnosticOptions]’
   228 |       IntrusiveRefCntPtrInfo<T>::retain(Obj);
       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/lib/llvm-21/include/llvm/ADT/IntrusiveRefCntPtr.h:180:43:
required from ‘llvm::IntrusiveRefCntPtr<T>::IntrusiveRefCntPtr(T*) [with
T = clang::DiagnosticOptions]’
   180 |   IntrusiveRefCntPtr(T *obj) : Obj(obj) { retain(); }
       |                                           ^~~~~~
/build/reproducible-path/bpfcc-0.35.0+ds/src/cc/frontends/clang/loader.cc:399:74:
   required from here
   399 |   IntrusiveRefCntPtr<DiagnosticOptions> diag_opts(new
DiagnosticOptions());
       |
          ^
/usr/lib/llvm-21/include/llvm/ADT/IntrusiveRefCntPtr.h:163:37: error:
‘class clang::DiagnosticOptions’ has no member named ‘Retain’
   163 |   static void retain(T *obj) { obj->Retain(); }
       |                                ~~~~~^~~~~~

#1122606#12
Date:
2025-12-15 08:14:15 UTC
From:
To:
Control: tags -1 patch

Looks like there's a patch for this upstream:

https://github.com/iovisor/bcc/commit/8c5c96ad3beeed2fa827017f451a952306826974

Cheers,
Emilio

#1122606#19
Date:
2025-12-20 16:48:30 UTC
From:
To:
I tested the upstream patch with clang 19, and it worked just fine
here.  I pushed the patch to salsa.

diff --git a/debian/patches/0002-clang-21.patch b/debian/patches/0002-clang-21.patch
new file mode 100644
index 00000000..f8e7eb04
--- /dev/null
+++ b/debian/patches/0002-clang-21.patch
@@ -0,0 +1,46 @@
+commit 8c5c96ad3beeed2fa827017f451a952306826974
+Author: yonghong-song <ys114321@gmail.com>
+Date:   Mon Jul 14 20:21:59 2025 -0700
+Origin: https://github.com/iovisor/bcc/commit/8c5c96ad3beeed2fa827017f451a952306826974
+Bug-Debian: https://bugs.debian.org/1122606
+Forwarded: not-needed
+Last-Update: 2025-12-20
+
+    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.
+
+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<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
+
diff --git a/debian/patches/series b/debian/patches/series
index 21b3c377..6a302de5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ fix-install-path.patch
 2002_fix_netqtop.c_path.patch
 2003-libbpf-tools-debian.patch
 0001-Cleanup-existing-temporary-kernel-headers-path.patch
+0002-clang-21.patch

#1122606#26
Date:
2025-12-29 20:01:48 UTC
From:
To:
I am uploading the patch that Petter has pushed as NMU to DELAYED/5.
The changelog entry is also pushed to git.

#1122606#31
Date:
2026-01-03 20:34:23 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
bpfcc, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1122606@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Bastian Germann <bage@debian.org> (supplier of updated bpfcc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Mon, 29 Dec 2025 20:57:31 +0100
Source: bpfcc
Architecture: source
Version: 0.35.0+ds-1.1
Distribution: unstable
Urgency: medium
Maintainer: Ritesh Raj Sarraf <rrs@debian.org>
Changed-By: Bastian Germann <bage@debian.org>
Closes: 1122606
Changes:
 bpfcc (0.35.0+ds-1.1) unstable; urgency=medium
 .
   * Non-maintainer upload
 .
   [ Petter Reinholdtsen ]
   * [ade87c1] Fixed clang 21 build problem (Closes: #1122606)
Checksums-Sha1:
 bb4ebb0a6d3a72a0195b5470353e47cd36296d64 2780 bpfcc_0.35.0+ds-1.1.dsc
 255e307c462bcc97b0778e1eb13e3797e001ad1d 23544 bpfcc_0.35.0+ds-1.1.debian.tar.xz
 73b918d66885c4a9334c39d0dac7af12f58ac63f 8723 bpfcc_0.35.0+ds-1.1_source.buildinfo
Checksums-Sha256:
 ee547304afd183a4bb366e5dc002fe3506c5b773d722a0f62e1a93765e7f17c3 2780 bpfcc_0.35.0+ds-1.1.dsc
 80d3852fd094d395361b9ffcb6936b8a498fdcfaa03770cdb0d3ce195606fde3 23544 bpfcc_0.35.0+ds-1.1.debian.tar.xz
 fb28499e62695c1196fe2a3ce60ef0a688a82ca880cbf7c4cd9cf57376bb00d4 8723 bpfcc_0.35.0+ds-1.1_source.buildinfo
Files:
 8f1278c119bbd964fc98fb8808305e43 2780 misc optional bpfcc_0.35.0+ds-1.1.dsc
 7b440f94e4425ffd2f5feb7da1df2594 23544 misc optional bpfcc_0.35.0+ds-1.1.debian.tar.xz
 e22aa7fd8a01a2313274c8f21df6a3ec 8723 misc optional bpfcc_0.35.0+ds-1.1_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQHEBAEBCgAuFiEEQGIgyLhVKAI3jM5BH1x6i0VWQxQFAmlS3a4QHGJhZ2VAZGVi
aWFuLm9yZwAKCRAfXHqLRVZDFFmPC/41p/ngS3VGGrHRSNbayBSK4VLUed9wJmF0
2v1s2qNJei+0PgqAD+x1CGQfLT3QRETH5BlbKjcF0xZGRW72u25eqCP9jfRHRAUv
ZBZAES0QjNjLxGvcgSg0iVLgOSX5eEwuWv9zHD3p5dOjygnp+mbD0sPEmdbDAycx
1akuJKZCZhi/o0rPuwx4PXB9rXLQECQFE2Xw1BbeFfmjCav8xB2PFWpNqPMpg0vk
VndmFFnXRXSrgQI+8ze/9V6YoBj8su66s/gSgb7PTmrTd5UJIJW1L8/KpxQhxoRt
SjCgxwwCDMzsylzX5G0+AZKk7rvLRpJ+PqplhUojthGvftX1nVDxdfUkSS1K8cUc
29ywWbOq0GowZvtPMCySRXeO9XoNxiC4D4jN2tUXHaA/NBao4lWyuhfpdceOKKwA
Hp7+8qElYNJprVpLF9TbyRBi7hPS/uW+twJtO+L71XugtuZkIA+qdlwD2xeUEBvN
Mlz87K1ji9t1+cpKaUKlpNHLX6vMfK8=
=h3f+
-----END PGP SIGNATURE-----