You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* x86 Linux (but the few binary dependencies could easily be changed for aarch64)
23
24
* Docker installed and running. It should work fine with [podman](https://podman.io/) but it has not been tested.
24
25
*[GraalVM for JDK 21](https://www.graalvm.org/downloads/)
25
26
26
27
> We recommend Oracle GraalVM for the best experience. It is licensed under the [GraalVM Free Terms and Conditions (GFTC)](https://www.oracle.com/downloads/licenses/graal-free-license.html) license, which permits use by any user including commercial and production use.
27
-
GraalVM Community Edition JDK 21 works too, but Native Image generated executables sizes will differ.
28
+
GraalVM Community Edition for JDK 21 works too, but Native Image generated executables sizes will differ.
28
29
29
30
> These instructions have only been tested on Linux x64.
30
31
31
32
## Setup
32
33
34
+
You need the following zlib packages installed:
35
+
* zlib.x86_64
36
+
* zlib-devel.x86_64
37
+
* zlib-static.x86_64
38
+
39
+
On Oracle Linux, you can install with:
40
+
```sh
41
+
sudo yum install -y zlib.x86_64
42
+
sudo yum install -y zlib-devel.x86_64
43
+
sudo yum install -y zlib-static.x86_64
44
+
```
45
+
33
46
Clone this Git repo and in your Linux shell type the following to download and
34
47
configure the `musl` toolchain.
35
48
36
49
`./setup-musl.sh`
37
50
51
+
Download [upx](https://upx.github.io/):
52
+
53
+
`./setup-upx.sh`
38
54
39
55
## Hello World
40
56
@@ -62,7 +78,8 @@ equivalent. They just print "Hello World". But there are a few points worth
62
78
noting:
63
79
64
80
1. The executable generated by GraalVM Native Image using the
65
-
`--static --libc=musl` options is a fully self-contained executable which can be confirmed by examining it with `ldd`:
81
+
`--static --libc=musl` options is a fully self-contained executable which can be
82
+
confirmed by examining it with `ldd`:
66
83
67
84
`ldd hello`
68
85
@@ -80,22 +97,26 @@ noting:
80
97
executable, you can be confident it is also statically linked.
81
98
82
99
2. Both executables are the result of compiling a Java bytecode application into
83
-
native machine code. The uncompressed executable is only 5.2MB! There's no
100
+
native machine code. The uncompressed executable is only ~6.3MB! There's no
84
101
JVM, no JARs, no JIT compiler and none of the overhead it imposes. Both
85
102
start extremely fast as there is minimal startup cost.
86
103
87
-
3. The `upx` compressed executable is about 60% smaller, 1.5MB vs. 5.2MB! With
88
-
`upx`` the application self-extracts quickly but does incur a cost of about
89
-
100ms for decompression. See this blog for a deep dive on [GraalVM Native Image and UPX](https://medium.com/graalvm/compressed-graalvm-native-images-4d233766a214).
104
+
3. The `upx` compressed executable is over 70% smaller, 1.7MB vs. 6.3MB! With
105
+
`upx` the application self-extracts quickly but does incur a cost of about
106
+
100ms for decompression. See this blog for a deep dive on [GraalVM Native
0 commit comments