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

Michael Biebl <[email protected]>
Newsgroups gmane.linux.debian.ports.amd64
Message-ID <178731106433.69304.2120269622626186436.reportbug__6755.7255549886$1787311172$gmane$org@mars>
Package: gcc-bpf
Version: 21
Severity: normal
X-Debbugs-Cc: [email protected], [email protected], [email protected]
User: [email protected]
Usertags: ppc64
User: [email protected]
Usertags: sparc64
User: [email protected]
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


-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 7.1.8+deb14.1-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gcc-bpf depends on:
pn  binutils-bpf  <none>
ii  libc6         2.43-3
ii  libgmp10      2:6.3.0+dfsg-5+b2
ii  libmpc3       1.3.1-3
ii  libmpfr6      4.2.2-3
ii  libzstd1      1.5.7+dfsg-4
ii  zlib1g        1:1.3.dfsg+really1.3.2-3

gcc-bpf recommends no packages.

gcc-bpf suggests no packages.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.