#1145004 Fails to compile eBPF programs on ppc64, sparc64 and x32

Package:
gcc-bpf
Source:
gcc-bpf
Description:
GNU C compiler for bpf
Submitter:
Michael Biebl
Date:
2026-09-02 14:41:02 UTC
Severity:
normal
#1145004#5
Date:
2026-08-21 11:17:44 UTC
From:
To:
Package: gcc-bpf
Version: 21
Severity: normal
X-Debbugs-Cc: debian-amd64@lists.debian.org, debian-powerpc@lists.debian.org, debian-sparc@lists.debian.org
User: debian-powerpc@lists.debian.org
Usertags: ppc64
User: debian-sparc@lists.debian.org
Usertags: sparc64
User: debian-x32@lists.debian.org
Usertags: x32

In https://salsa.debian.org/utopia-team/network-manager/-/merge_requests/18
support for CLAT (464XLAT) in NetworkManager was enabled.
It is implemented using an eBPF program.

This resulted in build failures on ppc64, sparc64 and x32 (and alpha).


ppc64
=====
https://buildd.debian.org/status/fetch.php?pkg=network-manager&arch=ppc64&ver=1.58.0-3&stamp=1786826236&raw=0

/usr/bin/bpf-gcc -std=gnu17 -Wunused -Wimplicit-fallthrough -fno-stack-protector -fno-ssa-phiopt -O2 -mcpu=v3 -mco-re -gbtf -c -D__powerpc64__ -D__TARGET_ARCH_powerpc -D_CALL_ELF=2 -mbig-endian -I. -isystem /usr/include/powerpc64-linux-gnu -idirafter /usr/include ../src/core/bpf/clat.bpf.c -o src/core/bpf/clat.bpf.unstripped.o
In file included from /usr/include/features.h:563,
                 from /usr/include/powerpc64-linux-gnu/sys/socket.h:22,
                 from /usr/include/linux/if.h:28,
                 from /usr/include/linux/icmp.h:23,
                 from ../src/core/bpf/clat.bpf.c:16:
/usr/include/powerpc64-linux-gnu/gnu/stubs.h:14:11: fatal error: gnu/stubs-64-v2.h: No such file or directory
   14 | # include <gnu/stubs-64-v2.h>
      |           ^~~~~~~~~~~~~~~~~~~
compilation terminated.

sparc64
=======
https://buildd.debian.org/status/fetch.php?pkg=network-manager&arch=sparc64&ver=1.58.0-3&stamp=1786827038&raw=0

/usr/bin/bpf-gcc -std=gnu17 -Wunused -Wimplicit-fallthrough -fno-stack-protector -fno-ssa-phiopt -O2 -mcpu=v3 -mco-re -gbtf -c -D__sparc64__ -mbig-endian -I. -isystem /usr/include/sparc64-linux-gnu -idirafter /usr/include ../src/core/bpf/clat.bpf.c -o src/core/bpf/clat.bpf.unstripped.o
In file included from /usr/include/features.h:563,
                 from /usr/include/sparc64-linux-gnu/sys/socket.h:22,
                 from /usr/include/linux/if.h:28,
                 from /usr/include/linux/icmp.h:23,
                 from ../src/core/bpf/clat.bpf.c:16:
/usr/include/sparc64-linux-gnu/gnu/stubs.h:8:11: fatal error: gnu/stubs-32.h: No such file or directory
    8 | # include <gnu/stubs-32.h>
      |           ^~~~~~~~~~~~~~~~
compilation terminated.

x32
===
https://buildd.debian.org/status/fetch.php?pkg=network-manager&arch=sparc64&ver=1.58.0-3&stamp=1786827038&raw=0

/usr/bin/bpf-gcc -std=gnu17 -Wunused -Wimplicit-fallthrough -fno-stack-protector -fno-ssa-phiopt -O2 -mcpu=v3 -mco-re -gbtf -c -D__x86_64__ -mlittle-endian -I. -isystem /usr/include/x86_64-linux-gnux32 -idirafter /usr/include ../src/core/bpf/clat.bpf.c -o src/core/bpf/clat.bpf.unstripped.o
In file included from /usr/include/features.h:563,
                 from /usr/include/x86_64-linux-gnux32/sys/socket.h:22,
                 from /usr/include/linux/if.h:28,
                 from /usr/include/linux/icmp.h:23,
                 from ../src/core/bpf/clat.bpf.c:16:
/usr/include/x86_64-linux-gnux32/gnu/stubs.h:10:11: fatal error: gnu/stubs-64.h: No such file or directory
   10 | # include <gnu/stubs-64.h>
      |           ^~~~~~~~~~~~~~~~
compilation terminated.


On IRC, jrtc27 and waldi said this:

jrtc27
======
sparc64 is identified by __sparc__ && __arch64__, there is no __sparc64__ in the linux world
(some BSDs do however use it)
note __aarch64__ != __aarch64__ :)
... sigh I mistyped it there, just proves my point
__arch64__ != __aarch64__
waldi
=====
jrtc27: so the -D__sparc64__ was never correct
jrtc27
======
it's never been the right define for sparc64-linux-gnu, no
some software recognises it because it's confused
some software recognises it because of BSDs
(and some software recognises __sparcv9__ because of solaris)
some software recognises it because it's confused
https://wiki.debian.org/ArchitectureSpecificsMemo#Summary is your friend



Regards,
Michael

#1145004#12
Date:
2026-08-21 20:02:05 UTC
From:
To:
Hi Michael,

the issue here is that the BPF compiler is made to consume the target
architecture's glibc userspace headers as if it were compiling normal
target userspace code.

bpf-gcc is compiling for the BPF target, while the build explicitly adds:

/usr/include/powerpc64-linux-gnu
/usr/include/sparc64-linux-gnu
/usr/include/x86_64-linux-gnux32

Those headers eventually pull in gnu/stubs.h, whose ABI selection
expects multilib glibc headers that aren't installed in the build
environment.

And should not be. Still you could provide them :).

1) I.e., you can add the (useless) target arch headers and make it compile:

Build-depend on g++-multilib

2) Drop CLAT on the affected architectures until upstream fixes the problem:

diff --git a/debian/rules b/debian/rules
index 76a5728a..064fc2e6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,6 +10,17 @@ export PYTHON=/usr/bin/python3

  PPPD_PLUGIN_DIR := $(shell dh_ppp --plugin-dir)

+# GCC's BPF target currently gets the target's multiarch libc include
+# directory from NetworkManager's Meson build. On architectures where
+# the corresponding multilib glibc headers are not installed, this causes
+# bpf-gcc to include gnu/stubs.h and fail. Disable CLAT until the BPF
+# include-path handling is fixed upstream.
+ifeq ($(filter $(DEB_HOST_ARCH),ppc64 sparc64 x32),)
+CLAT_OPTION := -Dclat=true
+else
+CLAT_OPTION := -Dclat=false
+endif
+
  %:
         dh $@ --with ppp

@@ -54,7 +65,7 @@ override_dh_auto_configure:
                 -Dovs=true \
                 -Dqt=false \
                 -Debpf=false \
-               -Dclat=true \
+               $(CLAT_OPTION) \
                 -Dbpf-compiler=gcc \
                 -Dnbft=false \
                 -Dofono=true

3) Fix the upstream meson build. This is a bit out of scope for Debian
packaging but if you wanna do upstream work:

Removing the (useless) cross-build logic in src/core/*bpf*/meson.build
should™ fix it.

Kind regards,
Daniel

#1145004#17
Date:
2026-08-22 13:40:29 UTC
From:
To:
[I'm not subscribed, so please CC me on replies]

Hi Daniel


gcc upstream, meson upstream or NetworkManager upstream?

I'd rather have a proper fix tbh and given that those are only ports,
it's not that pressing.

Which cross-build logic do you have in mind here in particular?

I do see a couple or architecture speficic defines at
https://salsa.debian.org/utopia-team/network-manager/-/blob/debian/latest/src/core/bpf/meson.build?ref_type=heads#L133-143

Interestingly no sparc64 and x32 specific build flags.

Could you mark the code, that you deem problematic?

Michael

#1145004#22
Date:
2026-08-22 15:41:10 UTC
From:
To:
Am 22.08.26 um 15:40 schrieb Michael Biebl:
It did not help. The build failure is the same.

$ apt-cache policy g++-multilib
g++-multilib:
   Installed: 4:16.1.0-3
   Candidate: 4:16.1.0-3
   Version table:
  *** 4:16.1.0-3 500
         500 http://deb.debian.org/debian-ports sid/main ppc64 Packages
         100 /var/lib/dpkg/status


$ ninja
[1/58] Generating src/core/bpf/clat.bpf.unstripped.o with a custom command
FAILED: [code=1] src/core/bpf/clat.bpf.unstripped.o
/usr/bin/bpf-gcc -std=gnu17 -Wunused -Wimplicit-fallthrough
-fno-stack-protector -fno-ssa-phiopt -O2 -mcpu=v3 -mco-re -gbtf -c 
-D__powerpc64__ -D__TARGET_ARCH_powerpc -D_CALL_ELF=2 -mbig-endian -I. 
-isystem /usr/include/powerpc64-linux-gnu -idirafter /usr/include 
../src/core/bpf/clat.bpf.c -o src/core/bpf/clat.bpf.unstripped.o
In file included from /usr/include/features.h:563,
                  from /usr/include/powerpc64-linux-gnu/sys/socket.h:22,
                  from /usr/include/linux/if.h:28,
                  from /usr/include/linux/icmp.h:23,
                  from ../src/core/bpf/clat.bpf.c:16:
/usr/include/powerpc64-linux-gnu/gnu/stubs.h:14:11: fatal error:
gnu/stubs-64-v2.h: No such file or directory
    14 | # include <gnu/stubs-64-v2.h>
       |           ^~~~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.

#1145004#27
Date:
2026-08-24 13:40:16 UTC
From:
To:
Hi Michael,

Am 22.08.26 um 15:40 schrieb Michael Biebl:

Dunno. The headers are missing and can be found in the g++-multilib.
The NetworkManager upstream copied src/core/bpf/meson.build from
https://github.com/systemd/systemd/pull/20429 by their own account and ... probably did not fully understand the code.

As stated before, this is a build issue in NetworkManager and adding g++-multilib is a hack, not a proper fix.

[from your other email:]

You chose the one arch where -D_CALL_ELF=2 does not work. Afaik it can only do ELF ABI v1.
So you run into that additional build problem on this arch.

Cf. ELF ABI v2

https://packages.debian.org/search?searchon=contents&keywords=gnu%2Fstubs-64-v2.h&mode=path&suite=unstable&arch=any

vs. ELF ABI v1

https://packages.debian.org/search?searchon=contents&keywords=gnu%2Fstubs-64-v1.h&mode=path&suite=unstable&arch=any

NetworkManager upstream
(yes, the Debian bug points wrong atm)

Ack. Then leave it broken until upstream fixes it.
If you ever change your mind and want newer NetworkManager on the niche arches, you can just disable building the CLAT BPF code.

$ git diff meson.build
diff --git a/src/core/bpf/meson.build b/src/core/bpf/meson.build
index 39b978dd..97d76511 100644
--- a/src/core/bpf/meson.build
+++ b/src/core/bpf/meson.build
@@ -166,25 +166,6 @@ endif

  bpf_o_unstripped_cmd += ['-I.']

#1145004#32
Date:
2026-09-02 12:22:44 UTC
From:
To:
Control: reassign -1 network-manager
Control: found -1 1.58.0-3
Control: forwarded -1 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/work_items/2012

#1145004#45
Date:
2026-09-02 14:39:23 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
network-manager, 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 1145004@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Biebl <biebl@debian.org> (supplier of updated network-manager 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: Wed, 02 Sep 2026 14:46:44 +0200
Source: network-manager
Architecture: source
Version: 1.58.1-1
Distribution: unstable
Urgency: medium
Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>
Changed-By: Michael Biebl <biebl@debian.org>
Closes: 1145004 1145695
Changes:
 network-manager (1.58.1-1) unstable; urgency=medium
 .
   * New upstream version 1.58.1
   * Fix test suite failure with glib 2.89.
     Thanks to Simon McVittie (Closes: #1145695)
   * Fix clat/eBPF compilation on ppc64 and sparc64 (Closes: #1145004)
Checksums-Sha1:
 2cd168e87bf40cbc7ee2b630ddfeb735acd17606 3573 network-manager_1.58.1-1.dsc
 53e8c870acd3c0ee88bd9af5cfab15ece9d1bd7f 8812900 network-manager_1.58.1.orig.tar.bz2
 6847996f77bc7d7dd04f5b6e787c167d29e6f860 61988 network-manager_1.58.1-1.debian.tar.xz
 b097eff2ee76dc9fe7b4f49fc65c04ffb4b876cb 11925 network-manager_1.58.1-1_source.buildinfo
Checksums-Sha256:
 4019446cd3e731da0fe8e45aecde9da2113666072d4d6f80f080dd2cb5135ade 3573 network-manager_1.58.1-1.dsc
 50f0beefa02ff16159177e88379d7819edf6527b2cc25639ab4e62d8a15ca127 8812900 network-manager_1.58.1.orig.tar.bz2
 4580cb366a62c68d04df14a23cf4d4deaddff4187bfb299dc24f209429e16da4 61988 network-manager_1.58.1-1.debian.tar.xz
 af604eb567bffc9747c181945cf2e65e1f26a1f0d97d139e9645ca8555678911 11925 network-manager_1.58.1-1_source.buildinfo
Files:
 dcb41b85829fa30e8aa96c47c873c81c 3573 net optional network-manager_1.58.1-1.dsc
 8c931014bc87be60c81f9fca98c46c30 8812900 net optional network-manager_1.58.1.orig.tar.bz2
 6353eb253d35229a273857b7166cf7ec 61988 net optional network-manager_1.58.1-1.debian.tar.xz
 5d22b5cb04b305b32b5763f1013061ce 11925 net optional network-manager_1.58.1-1_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEECbOsLssWnJBDRcxUauHfDWCPItwFAmqYKJAACgkQauHfDWCP
ItzkTA/9HJ6VWlCtpxrtZI2pwveuK/aATU7bTFkU9jB6L+EifCcqDLns/TzDL/Dj
2L+VMha3bWBmHcDfv7qcaqevThdOR5EghNJkbA2W8FAJO6zjRQr9+R2mkFXJ7qrF
RR5aP3a54BKut2/FYZTUXg4b+XIMaTWmHDukmFdEuwKVEWozR9t/AcNwlYpfJLl3
dGzBPcbbhvSZBVuzpe2KVAvJblkD6dsGZf+s8jZvDDQ4po1TPJijFZIAzaJN1lNw
YeawUbEfLj8xb6xEBbU4zcwbWvCPFAdkYF2O9Z1JRRXHZNNtn4KnVomZhWjgGLaz
i27AultoKZ29ibwzO8HkKkpJi5khnH/o78+U8pOfvpMLx9nJUqnXakj4NPczI6OJ
grpDRCIETLhTEjBbune4wjMVEtEkRAtDsWxPNS4rFTjDVarZ0cngHMMnammfTf0C
HRaoczap/Wn+dMgJ8WuXX+9cV7AbEzFtUQNUcS4GE5HuTxN19p3APtcq9yK6KSpV
2pN/ozOGbLK+tcw08dUOQeEypdZIEKQVMM9dhSPif53US1Y69lcgqMoakoUM7rGu
stQ0NWS495rHennctMJRqOUEc09yqEywbtNAxAteRSyM4CSxn5qIFVfEgNdcYUfO
+x3xfqyZn2AjGV6tnZme0sEKEq9wUutl8rU0YPTcxTr9NGxEScs=
=8jTX
-----END PGP SIGNATURE-----