Just in (May/19) - openjdk9
(experimental) for AArch64 is now available from Alpine repositories!
Package details:
https://pkgs.alpinelinux.org/package/edge/testing/aarch64/openjdk9
Grab it using:
apk add openjdk9 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
The other day I had to build OpenJDK from source on musl Alpine 3.8. Luckily, it was quite smooth! So, if you'll end up having to build OpenJDK from source for ARM64 musl support, you could follow these steps with some modifications for your target.
Note 1: To extend the discussion in comments, OpenJDK on musl Alpine is currently work in progress. The latest available is JDK 12 early access, for X64 only: http://jdk.java.net/12. JDK 9, 10 and 11 have development branches, but were not GA'd and officially released. Depending on your usage of the built OpenJDK, this should be seriously considered.
Naturally, it's always better to use ready and tested OpenJDK binaries, if such are available.
Note 2: The below steps were tested with OpenJDK 11, over Alpine 3.8 traditional disk installation (not docker), on a X86 workstation.
Prerequisites:
Packages
The following packages should be installed prior to build (hope I'm not missing any):
// build tools and utilities
apk add build-base autoconf bash coreutils gawk grep mercurial zip
// X11 libraries
apk add libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev
// Additional libraries
apk add alsa-lib-dev cups-dev fontconfig-dev
Boot JDK
Then, ironically, you need a boot JDK: OpenJDK of the same of previous version installed... It could be OpenJDK that runs on the host (not cross compiled), so you should get your hands on OpenJDK 10 or 11 musl X86 builds.
At some point, an OpenJDK 11 early access binary was made available, but it was removed from the OpenJDK download page, since it was not production ready. For JDK bootstrapping, it may be enough, so try getting a hold of it: openjdk-11+28_linux-x64-musl_bin.tar.gz
. If you want (or have to) stick to JDK9, then OpenJDK 8 could be used for bootstrapping, and no problem there since it's available as the openjdk8
apk package.
Usually the boot JDK is automatically picked by the build, but if not, you could specify it to configure with --with-boot-jdk=[path-to-jdk]
.
Sources:
For Alpine OpenJDK builds, you should use OpenJDK's Portola branches. These are already compatible with musl. There are branches for JDK 9, 10 and 11. As noted above, they are experimental.
For grabbing the OpenJDK 11 source code:
hg clone https://hg.openjdk.java.net/portola/jdk11
Building:
Once you had everything set up, build is quite simple. I used:
cd jdk11
bash configure
make JOBS=8 LOG=info hotspot
References:
For further reference, see the JDK11 build instructions (not for Alpine specifically):
OpenJDK cross compiling: