Skip to content

build: remove 32-bit library dependencies for eBPF compilation - #191

Merged
taodd merged 1 commit into
mainfrom
fix/remove-32bit-dependency
Sep 3, 2026
Merged

taodd merged 1 commit into
mainfrom
fix/remove-32bit-dependency

Conversation

@taodd

@taodd taodd commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

Including <string.h> in BPF kernel-space programs (radostrace.bpf.c and osdtrace.bpf.c) caused clang -target bpf to pull in glibc's <features.h> and <gnu/stubs.h>. Because __x86_64__ is not defined when targeting BPF, gnu/stubs.h fell back to requiring <gnu/stubs-32.h>, creating an artificial dependency on 32-bit glibc development headers (libc6-dev-i386 on Debian/Ubuntu and glibc-devel.i686 on RHEL/CentOS/Rocky).

eBPF programs run in kernel/BPF context and do not link against glibc. The only function used from <string.h> was memset.

Changes

  • Removed #include <string.h> from src/radostrace.bpf.c and src/osdtrace.bpf.c.
  • Replaced all memset calls in src/radostrace.bpf.c and src/osdtrace.bpf.c with compiler builtin __builtin_memset directly.
  • Included <stddef.h> (freestanding compiler header) in src/bpf_utils.h for size_t.
  • Dropped libc6-dev-i386 and glibc-devel.i686 from debian/control, documentation (doc/getting-started.md, doc/building.md), tools (tools/gen_dwarf_for_version.sh), and CI workflows (.github/workflows/).

Including <string.h> in BPF kernel-space programs (radostrace.bpf.c and
osdtrace.bpf.c) caused clang -target bpf to pull in glibc's <features.h>
and <gnu/stubs.h>. Because __x86_64__ is not defined when targeting BPF,
gnu/stubs.h fell back to requiring <gnu/stubs-32.h>, creating an artificial
dependency on 32-bit glibc development headers (libc6-dev-i386 on Debian/
Ubuntu and glibc-devel.i686 on RHEL/CentOS/Rocky).

eBPF programs run in kernel/BPF context and do not link against glibc.
The only function used from <string.h> was memset.

Remove <string.h> from BPF programs and call the compiler intrinsic
__builtin_memset directly in radostrace.bpf.c and osdtrace.bpf.c, and
include <stddef.h> in bpf_utils.h for size_t. Drop libc6-dev-i386 and
glibc-devel.i686 from debian/control, documentation, tools, and CI workflows.
@taodd
taodd force-pushed the fix/remove-32bit-dependency branch from aa72056 to 5e4e05f Compare September 3, 2026 10:32
@taodd
taodd merged commit 5d999ab into main Sep 3, 2026
62 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant