-
Notifications
You must be signed in to change notification settings - Fork 147
Added FreeBSD aarch64 (ARM64) support #218
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
Conversation
if(OSUtil.isARM()) { | ||
if(OSUtil.is64Bit()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just be
if(OSUtil.isARM()) { | |
if(OSUtil.is64Bit()) { | |
if(OSUtil.isARM() && OSUtil.is64Bit()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! This looks good. As noted below, can you confirm that the -m64
flag is strictly necessary? Then I'm happy to merge.
My biggest reservation is that native libraries for all of the other supported platforms can be cross-compiled, and there's no off-the-shelf cross-compiler to target FreeBSD arm64 from Linux amd64. However, the actual build process integrates cleanly with the others, and it looks possible to extend the current FreeBSD cross-compilation environment to support arm64, so I'm happy to accept this as un-CI'd for now with the expectation that I'll be able to add it to CI later.
src/main/c/Makefile
Outdated
freebsdarm64v8: export CFLAGS += -I$(JAVA_HOME)/include/freebsd -m64 | ||
freebsdarm64v8: export LDFLAGS += -m64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the -m64
flag is AMD64-specific, and I suspect it's ignored outright when building for AArch64. Have you tried without the flag to confirm it's necessary, or if not, can you please do so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your right! I missed that one. I have removed the flag and verified the resulting binary still works.
96434ac
to
c7affa3
Compare
Thanks for the prompt review! I've addressed your feedback. On closer inspection I also noticed I needed to add the variant in the makefile so the resulting binary has the correct name. You might already know about it but there is also the Maven NAR plugin to aid in dealing with native code. |
src/main/c/Makefile
Outdated
@@ -239,6 +239,13 @@ freebsd64: export platform := freebsd/x86_64 | |||
freebsd64: | |||
$(MAKE) -f natives.mk | |||
|
|||
# Requires a FreeBSD host running on aarch64 (arm64) architecture. | |||
freebsdarm64v8: export CFLAGS += -I$(JAVA_HOME)/include/freebsd -m64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've removed the -m64
linker flag; did you try without the compiler one, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I totally missed the compiler flag. I either need more caffeine or more vacation it seems ;-)
Alright, took some tries but I think we've got there! Thanks for your patience! Building with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for being willing to iterate on this. (Thank you also for keeping a neat and tidy squashed history.) I'm quite happy with this now, and glad to merge it.
Tested on a Raspberry Pi 4.