Repository navigation
Closed
Description
Describe the bug
jbpf does not compile out-of-the-box on ARM machines.
When following the README and examples, an ARM user will come across a couple build issues. First, the provided Dockerfiles installs gcc-multilib which does not exist on ARM. There are two workarounds for this:
- ARM users can build for AMD by specifying a platform flag for docker build:
docker build --platform linux/amd64 -f <Dockerfile> . - ARM users can build natively for ARM by excluding
gcc-multilibfrom the Dockerfile
If an ARM user tries to build natively for ARM (option #2 above), they will come across a couple other issues when building jbpf and running the provided examples:
jbpf_start_timeandjbpf_end_timefunctions have inline x86 assembly. These function calls get called (and error) when running on ARM. There are several possible ways to fix this. You could also gate these functions onx86and replace the calls tojbpf_start_timeandjbpf_end_timewithjbpf_measure_start_timeandjbpf_measure_end_timerespectively, which are wrappers that can callclock_gettimedepending on the platform to avoid calling the asm. Or you could get rid of the asm and decideclock_gettimeis good enough on any platform. There are probably several more ways to fix this issue.- To get the examples working when building natively for ARM, I also had to apt install
libc6-devin the Dockerfile and modify some Include flags in the example Makefiles. Finally, I addedld-linux-aarch64.soto the approved libraries list inhelper_build_files/approved_libraries.txt.
To Reproduce
Steps to reproduce the behavior:
- On an ARM machine (like Mac M1/M2) follow the build instructions in the README and install dependencies page.
- Get Docker errors when building Dockerfile:
Package gcc-multilib has no installation candidate
- When building jbpf on ARM, see the following error regarding x86 asm in source code:
error: unknown register name 'rdx' in 'asm'
lto-wrapper: fatal error: /usr/bin/cc returned 1 exit status
compilation terminated.
Expected behavior
README instructions for building jbpf and running examples to work out of the box on ARM machines.
Desktop (please complete the following information):
- OS: Mac M1 Pro running macOS Sequoia
- Docker: version 27.5.1
Metadata
Metadata
Assignees
Labels
No labels
Activity
xfoukas commentedon Mar 21, 2025
Anita Tenjarla (@anita-tenjarla) thanks for raising this very detailed issue!
Indeed, we do not currently provide support for ARM, as our initial focus has been on x86.
However, we welcome any contributions that could help us get ARM working as well.
From your description I understand that you have already gotten jbpf working on ARM? If so, would you be open to create a PR with your suggested fixes? We are happy to work with you and discuss in more depth the sub-issues that you described and the right ways to address them.
anita-tenjarla commentedon Mar 21, 2025
Thanks for the quick response! I put up a PR with the changes I have working locally. With these changes, I'm able to build jbpf and run the standalone example for both ARM and AMD (depending on the --platform flag I give Docker). I'm not sure if this breaks anything for AMD users- open to all feedback.
xfoukas commentedon Mar 21, 2025
Thanks a lot for creating the PR!
We will go over it and will try to run tests locally and I will then get back to you with feedback.