New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build fails on Mac M1 #412
Comments
How are you reaching the conclusion the build failed? I don't see any error message |
When I tried to run the tests, they failed because it seems there is a binary that is missing. I assume it wasn't built during the build; otherwise, it should pass the tests. I might be wrong, though. This is part of the output log when I ran the tests: $ cmake --build build --target test --
Could not find executable [path]ubpf/build/external/bpf_conformance/bin/bpf_conformance_runner
Looked in the following places:
[path]ubpf/build/external/bpf_conformance/bin/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Release/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Release/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Debug/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Debug/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/MinSizeRel/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/MinSizeRel/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/RelWithDebInfo/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/RelWithDebInfo/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Deployment/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Deployment/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Development/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Development/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Release/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Release/bpf_conformance_runner
[path]ubpf/build/external/bpf_conformance/bin/Debug/bpf_conformance_runner
634 - [path]ubpf/tests/st.data-Interpreter (Not Run)
635 - [path]ubpf/tests/stack.data-JIT (Not Run)
636 - [path]ubpf/tests/stack.data-Interpreter (Not Run)
637 - [path]ubpf/tests/stack2.data-JIT (Not Run)
638 - [path]ubpf/tests/stack2.data-Interpreter (Not Run)
639 - [path]ubpf/tests/stack3.data-JIT (Not Run)
640 - [path]ubpf/tests/stack3.data-Interpreter (Not Run)
641 - [path]ubpf/tests/stb.data-JIT (Not Run)
642 - [path]ubpf/tests/stb.data-Interpreter (Not Run)
643 - [path]ubpf/tests/stdw.data-JIT (Not Run)
644 - [path]ubpf/tests/stdw.data-Interpreter (Not Run)
645 - [path]ubpf/tests/sth.data-JIT (Not Run)
646 - [path]ubpf/tests/sth.data-Interpreter (Not Run)
647 - [path]ubpf/tests/string-stack.data-JIT (Not Run)
648 - [path]ubpf/tests/string-stack.data-Interpreter (Not Run)
649 - [path]ubpf/tests/stw.data-JIT (Not Run)
650 - [path]ubpf/tests/stw.data-Interpreter (Not Run)
651 - [path]ubpf/tests/stx.data-JIT (Not Run)
652 - [path]ubpf/tests/stx.data-Interpreter (Not Run)
653 - [path]ubpf/tests/stxb-all.data-JIT (Not Run)
654 - [path]ubpf/tests/stxb-all.data-Interpreter (Not Run)
655 - [path]ubpf/tests/stxb-all2.data-JIT (Not Run)
656 - [path]ubpf/tests/stxb-all2.data-Interpreter (Not Run)
657 - [path]ubpf/tests/stxb-chain.data-JIT (Not Run)
658 - [path]ubpf/tests/stxb-chain.data-Interpreter (Not Run)
659 - [path]ubpf/tests/stxb.data-JIT (Not Run)
660 - [path]ubpf/tests/stxb.data-Interpreter (Not Run)
661 - [path]ubpf/tests/stxdw.data-JIT (Not Run)
662 - [path]ubpf/tests/stxdw.data-Interpreter (Not Run)
663 - [path]ubpf/tests/stxh.data-JIT (Not Run)
664 - [path]ubpf/tests/stxh.data-Interpreter (Not Run)
665 - [path]ubpf/tests/stxw.data-JIT (Not Run)
666 - [path]ubpf/tests/stxw.data-Interpreter (Not Run)
667 - [path]ubpf/tests/subnet.data-JIT (Not Run)
668 - [path]ubpf/tests/subnet.data-Interpreter (Not Run)
669 - [path]ubpf/tests/unload_reload.data-JIT (Not Run)
670 - [path]ubpf/tests/unload_reload.data-Interpreter (Not Run)
671 - map_TEST_INTERPRET (Not Run)
672 - map_TEST_JIT (Not Run)
673 - rel_64_32_TEST_INTERPRET (Not Run)
674 - rel_64_32_TEST_JIT (Not Run)
Errors while running CTest
Output from these tests are in: [path]ubpf/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
make: *** [test] Error 8 |
Interesting. FYI the output of my Is your brew x86 or arm? Maybe you wanna do |
That's interesting!
It is arm64. If I'm not mistaken, all M series are arm-based.
It is the same output as before, and the tests are not passing. |
Yep, but the M series supports x86 emulation using Rosetta. If you had a time machine backup that you used to migrate from the intel chip to the M chip, you would had got an x86 brew. Been there, done that. I have just set up a dual-architecture brew, i.e., brew in x86 and arm so I can interchange them when compiling the bpf projects. Can you try compiling a bpf using clang to make sure that is working?
This |
Aha, I see! No, I didn't migrate anything from the time machine.
Thank you!
Yes, it did! it compiled the |
I just happened to make a mistake that might have been yours. I was just going over the ubpf compilation again, and I did: cmake -S . -B build -DUBPF_ENABLE_TESTS=true -DUBPF_ALTERNATE_LLVM_PATH=$(brew --prefix llvm)/bin
cmake --build build --target test -- And I got a very similar output to yours, where tests didn't run. The mistake is that I forgot to actually compile everything before running the tests: cmake --build build --config Debug This should be done before trying to run the tests, as they depend on the project being compiled first. So the order should be: cmake -S . -B build -DUBPF_ENABLE_TESTS=true -DUBPF_ALTERNATE_LLVM_PATH=$(brew --prefix llvm)/bin
cmake --build build --config Debug
cmake --build build --target test -- |
Ah, yes! That was actually the mistake I made! I changed the config to
The tests output log for these two tests contains the following info:
Have you ever gotten into such a situation before by any chance? |
Yeah, tl;dr I am getting the same as you on the last 2 tests, I am ignoring that for now. Longer thoughts I have three guesses on why:
Testing it on a Linux machine (preferably x86, but potentially arm64 as well?) would be ideal to know which path to follow if one wanted to debug it further. Will a Linux machine get the same 0xffffff result (is it an integer overflow?)? Maybe more importantly, would a linux machine also explode the limit of nested function calls? I tried recompiling ubpf on my Mac with higher limits of nested function calls, making it to the hundreds, and it would still explode. So maybe there is an infinite loop somewhere? I can't commit to investigating it in the short term, though; feel free to do so, or just ignore them for now as well |
I see! That makes sense! Thank you for your help! On Linux with x86 architecture, I don't have any issues building and passing these tests. But, I'll go and see if I can fix this issue on Mac. |
Hi,
I tried to build uBPF on Mac M1. I successfully installed all prerequisites for the project. However, when I want to build the project, I get this:
Here it is my
llvm
version:I was wondering if I could build uBPF on Mac M1.
The text was updated successfully, but these errors were encountered: