Fully static native images on linux/arm64 support
As described in https://github.com/graalvm/container/issues/70 the blocker for being able to create fully static native images on linux/arm64 is GraalVM only supporting muslib on AMD64.
Hi, Thank you for your suggestion, we'll take a look at it shortly.
Tracked internally at GR 44077
@oubidar-Abderrahim do you have some ideas what concrete technical blockers are here?
That is, we are blocked because "GraalVM only supporting muslib on AMD64", so the next question is why GraalVM cannot support muslib on ARM64?
This blocks development on current Apple hardware.
$ sw_vers
ProductName: macOS
ProductVersion: 14.7
BuildVersion: 23H124
$ uname -a
Darwin redacted 23.6.0 Darwin Kernel Version 23.6.0: Wed Jul 31 20:49:46 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T8103 arm64
$ java --version
openjdk 21.0.2 2024-01-16
OpenJDK Runtime Environment GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.2+13.1 (build 21.0.2+13-jvmci-23.1-b30, mixed mode, sharing)
$ echo 'public class Test{public static void main(String[] a){System.out.println(".");}}' >Test.java
$ javac Test.java
$ docker run --rm -v $PWD:/app ghcr.io/graalvm/native-image-community:21.0.2-muslib -march=native Test
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
========================================================================================================================
GraalVM Native Image: Generating 'test' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing... (0.0s @ 0.06GB)
Error: Missing CAP cache value for: NativeCodeInfo:JNIHeaderDirectivesJDK21OrLater:ConstantInfo:JNI_VERSION_21
------------------------------------------------------------------------------------------------------------------------
0.2s (2.8% of total time) in 13 GCs | Peak RSS: 0.47GB | CPU load: 2.18
========================================================================================================================
Finished generating 'test' in 4.3s.
$ docker run --rm --platform=linux/amd64 -v $PWD:/app ghcr.io/graalvm/native-image-community:21.0.2-muslib -march=native Test
========================================================================================================================
GraalVM Native Image: Generating 'test' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing... (0.0s @ 0.06GB)
Error: Missing CAP cache value for: NativeCodeInfo:AArch64LibCHelperDirectives:StructInfo:CPUFeatures
------------------------------------------------------------------------------------------------------------------------
0.2s (2.6% of total time) in 13 GCs | Peak RSS: 0.47GB | CPU load: 2.12
========================================================================================================================
Finished generating 'test' in 4.7s.
$ docker run --rm -v $PWD:/app ghcr.io/graalvm/native-image-community:21.0.2 -march=native Test
========================================================================================================================
GraalVM Native Image: Generating 'test' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing... (4.5s @ 0.06GB)
Java version: 21.0.2+13, vendor version: GraalVM CE 21.0.2+13.1
Graal compiler: optimization level: 2, target machine: native
C compiler: gcc (redhat, aarch64, 11.4.1)
Garbage collector: Serial GC (max heap size: 80% of RAM)
1 user-specific feature(s):
- com.oracle.svm.thirdparty.gson.GsonFeature
------------------------------------------------------------------------------------------------------------------------
Build resources:
- <redacted>
- <redacted>
[2/8] Performing analysis... [*****] (16.8s @ 0.26GB)
3,253 reachable types (72.7% of 4,472 total)
3,840 reachable fields (50.1% of 7,660 total)
15,754 reachable methods (45.5% of 34,593 total)
1,030 types, 90 fields, and 676 methods registered for reflection
57 types, 57 fields, and 52 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
[3/8] Building universe... (1.3s @ 0.35GB)
[4/8] Parsing methods... [*] (1.0s @ 0.36GB)
[5/8] Inlining methods... [***] (0.9s @ 0.27GB)
[6/8] Compiling methods... [***] (7.8s @ 0.28GB)
[7/8] Layouting methods... [*] (0.8s @ 0.44GB)
[8/8] Creating image... [*] (1.1s @ 0.37GB)
5.11MB (39.81%) for code area: 8,940 compilation units
7.48MB (58.35%) for image heap: 97,372 objects and 48 resources
242.52kB ( 1.85%) for other data
12.83MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 origins of code area: Top 10 object types in image heap:
3.83MB java.base 1.59MB byte[] for code metadata
941.92kB svm.jar (Native Image) 1.29MB byte[] for java.lang.String
108.34kB java.logging 978.09kB java.lang.String
56.84kB org.graalvm.nativeimage.base 755.32kB java.lang.Class
43.64kB jdk.proxy1 279.55kB com.oracle.svm.core.hub.DynamicHubCompanion
42.03kB jdk.proxy3 278.63kB byte[] for general heap data
21.98kB org.graalvm.collections 242.20kB java.util.HashMap$Node
19.52kB jdk.internal.vm.ci 217.99kB java.lang.Object[]
10.46kB jdk.proxy2 186.00kB java.lang.String[]
8.03kB jdk.internal.vm.compiler 156.38kB byte[] for reflection metadata
2.95kB for 2 more packages 1.57MB for 908 more object types
------------------------------------------------------------------------------------------------------------------------
Recommendations:
INIT: Adopt '--strict-image-heap' to prepare for the next GraalVM release.
HEAP: Set max heap for improved and more predictable memory usage.
------------------------------------------------------------------------------------------------------------------------
4.0s (11.3% of total time) in 147 GCs | Peak RSS: 0.96GB | CPU load: 4.51
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
/app/test (executable)
========================================================================================================================
Finished generating 'test' in 34.7s
@oubidar-Abderrahim @wirthi
From my point of view (GraalVM user / java developer), there have been no new developments or activities in this area for what seems like 2 years. Is there anything new or progress in this regard? Is there now a comprehensible reason why GraalVM cannot support muslib on ARM64?
@tobiaswx aarch64 support for muslib is not a priority for us at the moment.
We are considering, however, to take a completely different approach here, by using an Alpine-based toolchain instead of a manually-built one. That might change the game and make it much easier to support aarch64 in addition to amd64.
@tobiaswx aarch64 support for muslib is not a priority for us at the moment.
The last Mac with Intel chips was sold in 2023.
It is likely that the upcoming macOS 16 drops support for Intel chips and with it Rosetta 2; i.e. in 6-9 months we will say goodbye to Java/GraalVM/NativeImage development on Macs.
https://github.com/oracle/graal/discussions/10760
Outlook GraalVM for JDK 25.0.0
- Platforms Windows AMD64 and Linux/MacOS AArch64
Let's hope this issue is part of the above…
Outlook GraalVM for JDK 25.0.0
- Platforms Windows AMD64 and Linux/MacOS AArch64
Let's hope this issue is part of the above…
Is the FFM support that is mentioned there related to the static libraries via Musl discussed in this ticket?
macOS 26 Tahoe
If Apple does not change its decision or their support window then fall 2029 will be the final goodbye to Intel.
But this is not just about macOS as a developer platform but also AWS Graviton as a deployment platform.
Use up to 60% less energy than comparable EC2 instances for the same performance.
I was wondering if there has been any progress on supporting muslib on ARM?
@tobiaswx aarch64 support for muslib is not a priority for us at the moment.
We are considering, however, to take a completely different approach here, by using an Alpine-based toolchain instead of a manually-built one. That might change the game and make it much easier to support aarch64 in addition to amd64.
Hi Thanks for the earlier clarification about aarch64 support and the possible switch to an Alpine-based toolchain. I was wondering if there has been any recent progress or updates on this approach? Really appreciate your efforts and just wanted to check in politely.