Skip to content
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

Provide native builds for ARM based Macs #1922

Closed
hendrikebbers opened this issue Jun 23, 2020 · 45 comments · Fixed by #2713
Closed

Provide native builds for ARM based Macs #1922

hendrikebbers opened this issue Jun 23, 2020 · 45 comments · Fixed by #2713
Assignees
Labels
arm Issues that affect or relate to the ARM OS macos Issues that affect or relate to the MAC OS
Milestone

Comments

@hendrikebbers
Copy link
Contributor

At WWDC20 Apple announced to move from Intel to ARM chips for Mac hardware. For the Java Community it will be important to support Java on those new devices. At Adopt we should provide native Java builds for the new hardware if possible.
This issue can be used to collect information about porting Java to ARM on Mac.

@hendrikebbers hendrikebbers added macos Issues that affect or relate to the MAC OS arm Issues that affect or relate to the ARM OS TSC-Agenda Issues that have been flagged as inclusions for a future TSC meeting labels Jun 23, 2020
@hendrikebbers
Copy link
Contributor Author

WWDC 2020 session "Port your Mac app to Apple Silicon": https://developer.apple.com/videos/play/wwdc2020/10214/

@karianna
Copy link
Contributor

Will need to see Apple's Mac OS X Port arrive upstream and get a developer kit

@hendrikebbers
Copy link
Contributor Author

One open point is the support for the new Metal rendering pipeline of Apple. OpenGL is deprecated in MacOS and I assume that it won't be supported on ARM based Macs anymore (verification is needed). Since OpenGL is already deprecated for some time the OpenJDK will take care of that by implementing a new rendering pipeline for Metal. You can find more info in JEP 382 and the Lanai project page. An early access build can be found here. How much of project Lanai must be refactored when targeting ARM is unknown.

@hendrikebbers
Copy link
Contributor Author

It is not clear how Java 8 and 11 will be handled. Even if we will get commits to the upstream to have OpenJDK working on ARM based Macs all this must be back ported if Java 8 and 11 LTS versions will be supported.

I do not know how this is handled for similar projects like https://openjdk.java.net/jeps/237. Maybe @jerboaa can give an answer? Next to this Microsoft published an article about the work on OpenJDK for Win/ARM. Repo can be found here. Maybe @karianna can say how that will be handled for 8 / 11?

@aahlenst
Copy link
Contributor

Regading OpenGL, quoting https://developer.apple.com/documentation/xcode/porting_your_macos_apps_to_apple_silicon:

OpenGL is deprecated, but is available on Apple silicon.

@jerboaa
Copy link
Contributor

jerboaa commented Jun 26, 2020

It is not clear how Java 8 and 11 will be handled. Even if we will get commits to the upstream to have OpenJDK working on ARM based Macs all this must be back ported if Java 8 and 11 LTS versions will be supported.

I do not know how this is handled for similar projects like https://openjdk.java.net/jeps/237. Maybe @jerboaa can give an answer?

I'd like to caution to not speculate on this at this stage. It's not clear what comes of this Mac on ARM announcement in terms of OpenJDK. So speaking of a backport of something which doesn't exist is way too early ;-)

Speaking for JEP 237 (Linux Aarch64 port integration into mainline). Originally the Aarch64 port project was incepted as an OpenJDK project. This is where development happened. That was well before JEP 237 happened. At some point it got proposed for inclusion into mainline. That's what JEP 237 is. It targeted JDK 9. Thus, OpenJDK 9+ has Aarch64 as supported architecture (on Linux) in mainline. The OpenJDK 8u code for Aarch64 is still maintained in an Aarch64 ports project's repository[1]. That is, Aarch64 support in OpenJDK 8u isn't in mainline OpenJDK 8u. Though, it's been proposed to get integrated into mainline OpenJDK 8u before and there is interest to get it integrated. Question is when that will happen.

[1] http://hg.openjdk.java.net/aarch64-port/jdk8u-shenandoah/

@hendrikebbers
Copy link
Contributor Author

@jerboaa THX for that feedback. I do not want to speculate. I just collect information to understand the big picture :)

@hendrikebbers
Copy link
Contributor Author

adding adoptium/adoptium-support#146

@hendrikebbers
Copy link
Contributor Author

Thread in JavaFX Dev Mailing List: https://mail.openjdk.java.net/pipermail/openjfx-dev/2020-July/026949.html

@hendrikebbers
Copy link
Contributor Author

http://openjdk.java.net/jeps/8251280

@hendrikebbers
Copy link
Contributor Author

SWT issue to provide universal binaries: https://bugs.eclipse.org/bugs/show_bug.cgi?id=565690

@vielmetti
Copy link

"JEP 391: macOS/AArch64 Port" - http://openjdk.java.net/jeps/391 - references JEP 237 (linux/aarch64) and JEP 388 (Windows on Arm).

@hendrikebbers
Copy link
Contributor Author

JDK Bugdatabase issue: https://bugs.openjdk.java.net/browse/JDK-8253795

@karianna
Copy link
Contributor

Sneak preview.. https://github.com/microsoft/openjdk-aarch64/releases/tag/16-ea%2B10-macos

@hendrikebbers
Copy link
Contributor Author

If someone would have told me 5 years ago that Microsoft provides the first Java 16 build for ARM based Macs ... :D

@VladimirKempik
Copy link

openjdk8/11/13 builds are available from azul - https://www.azul.com/downloads/zulu-community/?os=macos&architecture=arm-64-bit&package=jdk

@davidgiga1993
Copy link

Will there be a "universal binary" version available?
I'm asking because I use the jpackage utility to bundle my app and ideally there should be one bundle which runs on x86 and arm macs.
Or will I need to manually create a universal binary package?

@VladimirKempik
Copy link

Will there be a "universal binary" version available?
I'm asking because I use the jpackage utility to bundle my app and ideally there should be one bundle which runs on x86 and arm macs.
Or will I need to manually create a universal binary package?

Hello

I'm not sure if it's even possible for 11+, considering the module system

@davidgiga1993
Copy link

davidgiga1993 commented Nov 29, 2020

Will there be a "universal binary" version available?
I'm asking because I use the jpackage utility to bundle my app and ideally there should be one bundle which runs on x86 and arm macs.
Or will I need to manually create a universal binary package?

Hello

I'm not sure if it's even possible for 11+, considering the module system

Why shouldn't it be? I would assume you can just merge the arm and x86 binary and libs into universal versions using the lipo utility.
I don't have a M1 but I could try building a universal jvm.

@VladimirKempik
Copy link

don't forget to unpack some modules which has binaries ( like libjvm), lipo and then repack the modules.

@drej1
Copy link

drej1 commented Dec 1, 2020

Hi there, is there any roadmap when AdoptOpenJDK will support apple silicon architecture? Thanks

@aahlenst
Copy link
Contributor

aahlenst commented Dec 1, 2020

is there any roadmap when AdoptOpenJDK will support apple silicon architecture

The ARM port for Apple Silicon is in development at OpenJDK, see http://openjdk.java.net/jeps/391. As long as it isn't finished, it's unlikely that there's going to be a release from AdoptOpenJDK. We would like to provide nightly-builds soon-ish, but the build jobs haven't been set up yet (PRs are welcome).

@murkle
Copy link

murkle commented Dec 1, 2020

ARM-64 builds are already available here (Java 8, 11, 13, 16)

https://www.azul.com/downloads/zulu-community/?os=macos&architecture=arm-64-bit&package=jdk

@aahlenst
Copy link
Contributor

@ppetrosh Thanks a lot, very kind. We're basically waiting for a public branch to appear in OpenJDK. Is there already one? I've only seen that the JEP has been proposed.

@VladimirKempik
Copy link

JEP-391 was integrated into jdk17

now everyone can build 17ea for macarm

@aahlenst
Copy link
Contributor

aahlenst commented Mar 28, 2021

Let's get going.

@karianna karianna modified the milestones: Backlog, March 2021 Mar 29, 2021
@sxa
Copy link
Member

sxa commented Apr 15, 2021

Testing executes although work will be done to make it pass all the suites. Closing this as https://ci.adoptopenjdk.net/job/build-scripts/job/jobs/job/jdk/job/jdk-mac-arm64-hotspot/ will now run on a regular basis.

@sxa sxa closed this as completed Apr 15, 2021
@sxa sxa modified the milestones: March 2021, April 2021 Apr 15, 2021
@alexanderhenne
Copy link

@sxa Are you sure the artifacts in there contain arm64 binaries? file java shows Mach-O 64-bit executable x86_64 for me for build 35.

@gdams
Copy link
Member

gdams commented Apr 15, 2021

Hmm that's a bit worrying, let me double check again

@gdams
Copy link
Member

gdams commented Apr 16, 2021

@devLotto thanks for reporting, PR to fix here: #2573

@gdams
Copy link
Member

gdams commented Apr 18, 2021

@devLotto can you confirm that this is now fixed on your end? Thanks

@Adam-
Copy link

Adam- commented Sep 11, 2021

@devLotto can you confirm that this is now fixed on your end? Thanks

Hi gdams - we think that it is not fixed. Downloading this: https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-09-10-10-18-beta/OpenJDK17-jre_aarch64_mac_hotspot_2021-09-10-10-18.tar.gz (which at this time, is the latest nightly openjdk jre 17 mac aarch hotspot build) provides you with an x86_64 build.

@sxa
Copy link
Member

sxa commented Sep 12, 2021

Confirmed - that definitely appears to be a x64-capable binary:

build-macstadium-macos1014-x64-1:sxa jenkins$ wget -q -O - https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-09-10-10-18-beta/OpenJDK17-jre_aarch64_mac_hotspot_2021-09-10-10-18.tar.gz | tar xpfz -
tar: Failed to set default locale
build-macstadium-macos1014-x64-1:sxa jenkins$ jdk-17+35-jre/Contents/Home/bin/java -version
openjdk version "17-beta" 2021-09-14
OpenJDK Runtime Environment Temurin-17+35-202109092352 (build 17-beta+35-202109092352)
OpenJDK 64-Bit Server VM Temurin-17+35-202109092352 (build 17-beta+35-202109092352, mixed mode, sharing)
build-macstadium-macos1014-x64-1:sxa jenkins$

@sxa sxa reopened this Sep 12, 2021
@gdams
Copy link
Member

gdams commented Sep 13, 2021

Got a fix ready, looks like someone missed a line of code a while back

@gdams
Copy link
Member

gdams commented Sep 13, 2021

Confirmed to be fixed:

administrator@build-macstadium-macos11-arm64-2 bin % file java
java: Mach-O 64-bit executable arm64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arm Issues that affect or relate to the ARM OS macos Issues that affect or relate to the MAC OS
Projects
None yet
Development

Successfully merging a pull request may close this issue.