oracle / graal

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

Javac-related exceptions are thrown when building Native Images with GraalVM 23.1.1 For JDK 21.0.1 #7500

Closed linghengqian closed 10 months ago

linghengqian commented 1 year ago

Describe the issue A clear and concise description of the issue. We recommend using the latest snapshot builds to replicate the issue as bugs are constantly being fixed in the master branch

Steps to reproduce the issue Please include both build steps as well as run steps

  1. [e.g.: git clone --depth 1 https://git.myrepo.com/projectone ]
  2. [e.g.: mvn clean package]

git clone git@github.com:apache/shardingsphere.git cd ./shardingsphere/ git reset --hard 5575f8bf0764d84693304e498bc5806b25dcd7e0 ./mvnw clean install -Prelease -T1C -DskipTests -Djacoco.skip=true -Dcheckstyle.skip=true -Drat.skip=true -Dmaven.javadoc.skip=true

cd ../

git clone git@github.com:linghengqian/shardingsphere-graalvm-v2311-native-test.git cd ./shardingsphere-graalvm-v2311-native-test/ ./gradlew -Pagent clean test ./gradlew metadataCopy --task test ./gradlew clean nativeTest


**Describe GraalVM and your environment:**
 - GraalVM version (latest snapshot builds can be found [here](https://github.com/graalvm/graalvm-ce-dev-builds/releases)), or commit id if built from source: **[e.g. EE 19.3, CE 20.0, CE 20.1.0-dev-20200304_0848]** `CE 23.1.1`
 - JDK major version: **[e.g.:8]** `21`
 - OS: **[e.g. macOS Catalina]** `Ubuntu 22.04.3`
 - Architecture: **[e.g.: AMD64]** `AMD64`

**More details**
Consider adding the `--native-image-info` and  `--verbose` flags when building your native image and paste output below.

Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.
```shell
$ ./gradlew clean nativeTest
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details

> Task :generateTestResourcesConfigFile
[native-image-plugin] Resources configuration written into /home/linghengqian/TwinklingLiftWorks/git/public/shardingsphere-graalvm-v2311-native-test/build/native/generated/generateTestResourcesConfigFile/resource-config.json

> Task :nativeTestCompile
[native-image-plugin] GraalVM Toolchain detection is disabled
[native-image-plugin] GraalVM location read from environment variable: JAVA_HOME
[native-image-plugin] Native Image executable path: /home/linghengqian/.sdkman/candidates/java/21.0.1-graalce/lib/svm/bin/native-image
========================================================================================================================
GraalVM Native Image: Generating 'shardingsphere-graalvm-v2311-native-test-tests' (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...                                                                                   (16.7s @ 0.29GB)
 Java version: 21.0.1+12, vendor version: GraalVM CE 21.0.1+12.1
 Graal compiler: optimization level: 2, target machine: x86-64-v3
 C compiler: gcc (linux, x86_64, 11.4.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 3 user-specific feature(s):
 - com.oracle.svm.polyglot.groovy.GroovyIndyInterfaceFeature
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - org.graalvm.junit.platform.JUnitPlatformFeature
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 9.57GB of memory (75.6% of 12.67GB system memory, determined at start)
 - 6 thread(s) (100.0% of 6 available processor(s), determined at start)
[junit-platform-native] Running in 'test listener' mode using files matching pattern [junit-platform-unique-ids*] found in folder [/home/linghengqian/TwinklingLiftWorks/git/public/shardingsphere-graalvm-v2311-native-test/build/test-results/test/testlist] and its subfolders.
[2/8] Performing analysis...  []                                                                       (102.5s @ 3.64GB)
   25,844 reachable types   (78.0% of   33,132 total)
   40,751 reachable fields  (51.7% of   78,856 total)
  126,284 reachable methods (55.0% of  229,632 total)
    7,372 types,   786 fields, and 6,920 methods registered for reflection

------------------------------------------------------------------------------------------------------------------------
Error: java.util.concurrent.ExecutionException: java.lang.ClassCastException: class jdk.vm.ci.meta.NullConstant cannot be cast to class org.graalvm.compiler.core.common.type.TypedConstant (jdk.vm.ci.meta.NullConstant is in module jdk.internal.vm.ci of loader 'bootstrap'; org.graalvm.compiler.core.common.type.TypedConstant is in module jdk.internal.vm.compiler of loader 'platform')
                       18.5s (15.2% of total time) in 54 GCs | Peak RSS: 5.67GB | CPU load: 5.09
========================================================================================================================
Finished generating 'shardingsphere-graalvm-v2311-native-test-tests' in 2m 0s.

> Task :nativeTestCompile FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nativeTestCompile'.
> Process 'command '/home/linghengqian/.sdkman/candidates/java/21.0.1-graalce/bin/native-image'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2m 23s
7 actionable tasks: 7 executed
linghengqian commented 10 months ago
fernando-valdez commented 10 months ago

Thanks for the update, @linghengqian! Closing this ticket