oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
19.98k stars 1.6k forks source link

[GR-49757] CLI option handling, fail early when unsupported options are specifies (e.g. for ARM/DARWIN) #7640

Open gmuth opened 8 months ago

gmuth commented 8 months ago

native-image limitations are documented however not blocked by the tools.

Not supported but still "accepted" on startup:

# Apple Silicon machine, running macOS
native-image --static --libc=glibc -march=compatibility -o hello Hello
========================================================================================================================
GraalVM Native Image: Generating 'hello' (static executable)...
========================================================================================================================
[1/8] Initializing...                                                                                    (4,9s @ 0,11GB)
 Java version: 21.0.1+12, vendor version: Oracle GraalVM 21.0.1+12.1
 Graal compiler: optimization level: 2, target machine: compatibility, PGO: off
 C compiler: cc (apple, arm64, 14.0.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 1 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 24,18GB of memory (75,6% of 32,00GB system memory, determined at start)
 - 10 thread(s) (100,0% of 10 available processor(s), determined at start)
[2/8] Performing analysis...  [*****]                                                                    (3,8s @ 0,22GB)
    2.083 reachable types   (60,9% of    3.420 total)
    1.998 reachable fields  (45,8% of    4.362 total)
    9.602 reachable methods (38,4% of   25.006 total)
      735 types,   109 fields, and   474 methods registered for reflection
       49 types,    33 fields, and    48 methods registered for JNI access
        4 native libraries: -framework Foundation, dl, pthread, z
[3/8] Building universe...                                                                               (0,8s @ 0,28GB)
[4/8] Parsing methods...      [*]                                                                        (0,6s @ 0,29GB)
[5/8] Inlining methods...     [***]                                                                      (0,5s @ 0,28GB)
[6/8] Compiling methods...    [***]                                                                      (8,3s @ 0,29GB)
[7/8] Layouting methods...    [*]                                                                        (0,8s @ 0,32GB)
[8/8] Creating image...       [*
]                                                                        (0,0s @ 0,24GB)
Error: DARWIN does not support building static executable images.
hamzaGhaissi commented 8 months ago

Hi, to use native image static you need Linux AMD64 operating system, but this could be a new feature to blocked on startup

fniephaus commented 8 months ago

Thanks for raising this ticket. I agree, native-image should fail with a useful error message as soon as possible, definitely not after compilation.