-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add darwin-aarch64 support #1297
Add darwin-aarch64 support #1297
Conversation
Current state of the unit tests:
Click to show details
|
fe18e87
to
2d05c5d
Compare
59d3437
to
da125bb
Compare
@tresf were you able to rebuild the x86 (32bit) library with this? I was able to build x86-64 against an older SDK (is this needed or are mac OS builds backwards compatible?) and I was able to build aarch64 against the 12.X SDK. My understanding is, that Xcode 9 is needed to build x86, but that does not run on mac OS catalina. Do you have an advise what could be tested? My old build pipeline used travis-ci to build the mac OS libraries, but that also fails now (brew somehow changed and tries to compile JDK 15 on an old mac and times out). Maybe it is time to drop x86 for mac OS? |
I think this is an entirely reasonable decision. Apple officially stopped supporting 32-bit with macOS 10.15 (Catalina). OS warnings were given beginning in 10.13.4 (a High Sierra update) and throughout 10.14 (Mojave). Mac users who sill want to use 32-bit applications know they need to use an older version of the OS (and presumably an application depending on an older version of JNA as well). I, along with millions of other Mac users, have long since found replacements for 32-bit apps we loved. |
FWIW, while unsupported it is still possible to compile 32bit binaries even on the latest macOS Big Sur using the MacOSX SDK and compiler from Xcode 9.4.1 (just unpacking and applying a few tweaks to the Makefile is sufficient):
That being said, I agree that dropping 32bit support seems very reasonable. |
Apple SDKs are backwards compatible to a certain degree, e.g. the SDK that ships with Xcode 9.4.1 has a minimum deployment target of 10.4. To ensure the resulting library is actually backwards compatible, the deployment has to be set correctly and no new APIs may be referenced. There is a compiler warning that will flag usages of APIs that are not available for the given deployment target:
|
I would agree with the proposition of removing 32-bit binaries moving forward. Note, this doesn't actually remove 32-bit support from JNA, just stops shipping with it. The build environment was intentionally tested against the following configurations: PPC32, PPC64, x86, x86_64, ARM64.
If the team would like 32-bit tested, it would require a 32-bit JVM, which seems hard to come by. Looking at the Oracle Java 8 downloads, I can't find a build of Java 8 with 32-bit support for Apple, and they date back about 7 years. Similarly, Java 7's first release from Oracle for Mac only targeted 64-bit JVM, which was released 9 years ago. I think it's safe to say that testing a 32-bit binary will requiring going all the way back to Apple's Java 6 on a 32-bit machine or VM. If you'd like this tested prior to merging let me know, although @fkistner's findings about libffi suggest that there may be some incompatibilities with the temporary file handling ( |
@tresf @fkistner thank you both for working on mac os aarch64. I had a look at both PRs and I like the build approach taken here better. Reason is, that from my POV it simplifies the build logic. I.e. no black magic in the Makefile to build multiple architectures, just a single build. Things that need considering/doing:
After that is done, I should be able to rebuild the x86-64 binary with Xcode 9, the aarch64 binary with Xcode 12, and run unittests on x86-64. This will be merged and we can plan a release. |
From what I can tell, b802350 only applies to the "black-magic"
My mistake. @fkistner had answered my question over on 8b9e010 but I missed it. |
Slight clarification:
It also sets up the |
8ed6e97
to
ee6f6d9
Compare
Done via 1825df0, but merged into 6972631 and thanks to @Vzor- found out how to add attribution, so that's done as well. We reverted the i386 part of the |
Co-authored-by: Kyle Berezin <[email protected]> Co-authored-by: Florian Kistner <[email protected]>
Arm64 calling convention requires varargs to always be passed on the stack. JNA's and ffi's argument handling logic seems to handle this case correctly, but it is important that the Java definitions match their native counterparts exactly.
Big Sur uses a shared dylib cache to lookup system libraries and frameworks. Checking existence in the file system will fail, but loading them will succeed nevertheless.
Is there a timeline for a JNA release which has support for darwin-arm? |
I think it's safe to say, it will land as soon as possible. 21 hours ago @matthiasblaesing said the following:
All items requested are done. If anyone needs a version before that happens, please feel free to compile yourself. The documentation in this PR should be adequate to get you the files you need in snapshot form, which will contain the following architectures: libjnidispatch.jnilib (for architecture x86_64): Mach-O 64-bit dynamically linked shared library x86_64
+ libjnidispatch.jnilib (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64 Note, these steps can be done on an Intel or ARM Mac, but if cross-compiling, you'll need to provide the proper |
Merged to master - I had to do some additional fixes, as the changes to build.xml broke builds on windows. Apart from that looked good to me. |
@matthiasblaesing thanks, I tested "Move to Trash" on Mac M1 with Java Zulu with the latest darwin jnilib and it seems to be working. I also tested it on an Intel-based Mac and seems to be working there as well. |
When is the plan to release this? |
Per this post on the mailing list:
|
Just an FYI on fast-forwarding/upstream status...
|
This is a rework of #1238 which removes the multi-arch
Makefile
looping currently used on macOS and adapts it to only build a single, specified architecture, andlipo
it back onto the native library.TODO:
Description:
Previously, the
native/Makefile
blindly looped through supported architectures. Now, each arch is supplied manually, to mimic other environments. This has the advantage of a deterministic build, but to two slight disadvantages (1) Requires a second call toant
(2) ,${os.prefix}
now diverges from the resource path inside the jar, requiring a new${resource.prefix}
variable.A “fat” multi-arch library is still the resulting object.
Furthemore, in testing PPC builds, it appears there was some opportunity for cleanup, so some lines changed are as a result of that.
The bulk of the code changes are in 891c2b4 (or if it's been squashed out, the commit titled
Add darwin-aarch64 to build
).