Closed sgammon closed 1 year ago
========================================================================================================================
GraalVM Native Image: Generating 'elide.debug' (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... (8.0s @ 0.63GB)
Java version: 20.0.2+9, vendor version: Oracle GraalVM 20.0.2+9.1
Graal compiler: optimization level: b, target machine: compatibility, PGO: off
C compiler: cc (apple, arm64, 14.0.3)
Garbage collector: Serial GC (max heap size: 80% of RAM)
12 user-specific feature(s)
- com.oracle.svm.thirdparty.gson.GsonFeature
- com.oracle.svm.truffle.ICU4JFeature: Provides support for ICU4J library.
- com.oracle.svm.truffle.TruffleBaseFeature: Provides base support for Truffle
- com.oracle.svm.truffle.TruffleFeature: Enables compilation of Truffle ASTs to machine code
- com.oracle.truffle.espresso.ref.FinalizationFeature
- elide.runtime.feature.ProtocolBuffers: Configures native Protocol Buffers support
- elide.runtime.feature.VirtualFilesystem: Configures guest VFS features
- elide.runtime.feature.js.JsRuntimeFeature: Enables the Elide JS runtime
- io.micronaut.core.io.service.ServiceLoaderFeature
- io.micronaut.jackson.JacksonDatabindFeature
- org.graalvm.home.HomeFinderFeature: Finds GraalVM paths and its version number
- org.sqlite.nativeimage.SqliteJdbcFeature
[2/8] Performing analysis... [*] (30.1s @ 5.85GB)
38,824 (94.94%) of 40,892 types reachable
63,726 (65.91%) of 96,693 fields reachable
196,280 (66.16%) of 296,676 methods reachable
11,632 types, 916 fields, and 7,801 methods registered for reflection
2 native libraries: -framework CoreServices, stdc++
com.oracle.svm.core.util.VMError$HostedError: types reachable for JIT compilation must not have linkage errors
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.guarantee(VMError.java:93)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createType(GraalGraphObjectReplacer.java:318)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createMethod(GraalGraphObjectReplacer.java:240)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.updateDataDuringAnalysis(GraalGraphObjectReplacer.java:399)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.LegacyRuntimeCompilationFeature.duringAnalysis(LegacyRuntimeCompilationFeature.java:235)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:770)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:86)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:770)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:179)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:767)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:539)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:408)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:612)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:134)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)
Name | Value |
---|---|
Java version | 20.0.2+9 |
Vendor version | Oracle GraalVM 20.0.2+9.1 |
Runtime version | 20.0.2+9-jvmci-23.0-b14 |
C compiler | cc (apple, arm64, 14.0.3) |
release
fileThis is probably related to https://github.com/oracle/graal/issues/4473, and more generally, https://github.com/oracle/graal/issues/4923.
In a nutshell, currently using Truffle within an application can prevent the application from being built due to inlining not being performed before analysis.
For the next GraalVM release (23.1) this issue should be resolved.
@teshull native image builds other projects with micronaut v4 just fine, and we're building on micronaut v3 with the JS runtime just fine as well -- for some reason, this specific combination isn't working.
(even building our graalvm integration module as a shared library works just fine -- it's this same module that triggers the issue when used as a dependency.)
is there a way to work around this, or is there a chance the dev builds might already have a fix landed? could we, for instance, disable JIT to work around the linkage issue (briefly), until a fix lands?
not inlining is fine, obviously, there is a performance hit; but at the moment our build is halted entirely. we can't dump the JS VM because it's inherent to the project.
@teshull I can pass -H:+ParseOnceJIT
to avoid the LegacyRuntimeCompilationFeature
phase; if I do that, the error changes a bit and reveals the missing type as a Picocli proxy type (I will dig up the updated exception).
I understand this flag is experimental, but it at least yields further information, assuming the linkage error is the same.
Update: here is that exception. I can attach the full error report if needed. I can try to run on the dev builds for JVM17, but we're on JVM20 and Gradle 8.3-rc3
and it doesn't support JVM21 execution yet, further complicating a dev test (but we could pull it off if necessary).
com.oracle.svm.core.util.VMError$HostedError: com.oracle.graal.pointsto.util.AnalysisError$TypeNotFoundError: Type not found during analysis: AnnotationType<picocli.CommandLine$Parameters$$ProxyImpl -> HotSpotType<Ljdk/proxy4/$Proxy267;, resolved>>
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:76)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:702)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:539)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:408)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:612)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:134)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)
Caused by: com.oracle.graal.pointsto.util.AnalysisError$TypeNotFoundError: Type not found during analysis: AnnotationType<picocli.CommandLine$Parameters$$ProxyImpl -> HotSpotType<Ljdk/proxy4/$Proxy267;, resolved>>
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.typeNotFound(AnalysisError.java:145)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:236)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:220)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:197)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:78)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess$1.apply(UniverseMetaAccess.java:54)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess$1.apply(UniverseMetaAccess.java:51)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaType(UniverseMetaAccess.java:89)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaType(AnalysisMetaAccess.java:52)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaType(AnalysisMetaAccess.java:39)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess$1.apply(UniverseMetaAccess.java:54)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess$1.apply(UniverseMetaAccess.java:51)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaType(UniverseMetaAccess.java:89)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedMetaAccess.lookupJavaType(HostedMetaAccess.java:54)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedMetaAccess.lookupJavaType(HostedMetaAccess.java:46)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.meta.DirectSubstrateObjectConstant.getType(DirectSubstrateObjectConstant.java:55)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaType(UniverseMetaAccess.java:80)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedMetaAccess.lookupJavaType(HostedMetaAccess.java:59)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedMetaAccess.lookupJavaType(HostedMetaAccess.java:46)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.isInstanceOf(UniverseMetaAccess.java:96)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addConstant(NativeImageHeap.java:291)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.processAddObjectWorklist(NativeImageHeap.java:693)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageHeap.addTrailingObjects(NativeImageHeap.java:215)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.buildNativeImageHeap(NativeImageGenerator.java:744)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:684)
... 5 more
cc / @remkop I don't suppose this Proxy
is familiar?
cc / @remkop I don't suppose this
Proxy
is familiar?
Picocli does not have a type picocli.CommandLine$Parameters$$ProxyImpl
...
There is an annotation type picocli.CommandLine$Parameters
, and so I assume that this ProxyImpl
class is generated by the toolchain... but no idea where in the toolchain this would be.
@remkop we are using this with Micronaut via kapt
or ksp
(tried both), so it could come from picocli.codegen
or Micronaut's processors; I would guess the latter, but Micronaut v4 works fine with picocli and native image on another project. Thanks in any case for clarifying
could you please verify using our latest snapshot build from here: https://github.com/graalvm/graalvm-ce-dev-builds/releases
If the issue still persists, could you please share a reproducer code we can use for debugging and testing?
@oubidar-Abderrahim gradle doesn't yet support JVM21 and we're on JVM20, so we will move back to JVM17 and test from there; in terms of a reproducer, we haven't been able to capture one yet.
I've been able to "prove" that the issue arises when a particular project module is on the classpath, but that's as far as I've gotten. I can't unwind or pull apart the module without a major refactor, and it isn't yet clear if the issue arises from a dependency of that module (perhaps transitively) or the code which resides in it; complicating diagnosis, the module itself builds fine as a shared library, and runs tests natively fine (via JUnit). The module's dependencies, when added to another module, build fine natively.
That being said, the entire project is open source, so the bug should be reproducible via the following steps:
git clone git@github.com:elide-dev/elide.git -b release/alpha4-micronaut4
cd elide
./gradlew :packages:cli:nativeCompile
The module in question, which triggers the issue, is the graalvm
module, at packages/graalvm
. I'll report back when I have more information after building against dev.
@oubidar-Abderrahim alas, it looks like the same error is occurring against dev:
com.oracle.svm.core.util.VMError$HostedError: Types reachable for JIT compilation must not have linkage errors
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:78)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.guarantee(VMError.java:122)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createType(GraalGraphObjectReplacer.java:330)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createField(GraalGraphObjectReplacer.java:291)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createAllInstanceFields(GraalGraphObjectReplacer.java:369)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createType(GraalGraphObjectReplacer.java:343)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createMethod(GraalGraphObjectReplacer.java:266)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.LegacyRuntimeCompilationFeature.processMethod(LegacyRuntimeCompilationFeature.java:370)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.LegacyRuntimeCompilationFeature.duringAnalysis(LegacyRuntimeCompilationFeature.java:225)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:785)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:90)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:785)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:181)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:782)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:589)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:547)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:522)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:707)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
the error report:
========================================================================================================================
GraalVM Native Image: Generating 'elide.debug' (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... (7.3s @ 0.36GB)
Java version: 17.0.7+4, vendor version: GraalVM CE 17.0.7-dev+4.1
Graal compiler: optimization level: b, target machine: armv8-a
C compiler: cc (apple, arm64, 14.0.3)
Garbage collector: Serial GC (max heap size: 80% of RAM)
10 user-specific feature(s):
- com.oracle.svm.thirdparty.gson.GsonFeature
- com.oracle.svm.truffle.TruffleBaseFeature: Provides base support for Truffle
- com.oracle.svm.truffle.TruffleFeature: Enables compilation of Truffle ASTs to machine code
- elide.runtime.feature.ProtocolBuffers: Configures native Protocol Buffers support
- elide.runtime.feature.VirtualFilesystem: Configures guest VFS features
- elide.runtime.feature.js.JsRuntimeFeature: Enables the Elide JS runtime
- io.micronaut.core.io.service.ServiceLoaderFeature
- io.micronaut.jackson.JacksonDatabindFeature
- org.graalvm.home.HomeFinderFeature: Finds GraalVM paths and its version number
- org.sqlite.nativeimage.SqliteJdbcFeature
------------------------------------------------------------------------------------------------------------------------
Build resources:
- 26.49GB of memory (27.6% of 96.00GB system memory, determined at start)
- 12 thread(s) (100.0% of 12 available processor(s), determined at start)
[2/8] Performing analysis... [*] (30.0s @ 2.99GB)
32,890 reachable types (94.9% of 34,658 total)
59,699 reachable fields (68.6% of 87,056 total)
175,299 reachable methods (66.1% of 265,007 total)
10,727 types, 851 fields, and 7,206 methods registered for reflection
1 native library: -framework CoreServices
com.oracle.svm.core.util.VMError$HostedError: Types reachable for JIT compilation must not have linkage errors
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:78)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.guarantee(VMError.java:122)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createType(GraalGraphObjectReplacer.java:330)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createField(GraalGraphObjectReplacer.java:291)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createAllInstanceFields(GraalGraphObjectReplacer.java:369)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createType(GraalGraphObjectReplacer.java:343)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.GraalGraphObjectReplacer.createMethod(GraalGraphObjectReplacer.java:266)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.LegacyRuntimeCompilationFeature.processMethod(LegacyRuntimeCompilationFeature.java:370)
at org.graalvm.nativeimage.builder/com.oracle.svm.graal.hosted.LegacyRuntimeCompilationFeature.duringAnalysis(LegacyRuntimeCompilationFeature.java:225)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:785)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:90)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:785)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:181)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:782)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:589)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:547)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:522)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:707)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:142)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)
Name | Value |
---|---|
Java version | 17.0.7+4 |
Vendor version | GraalVM CE 17.0.7-dev+4.1 |
Runtime version | 17.0.7+4-jvmci-23.1-b02 |
C compiler | cc (apple, arm64, 14.0.3) |
release
fileTracked internally on GR 47873
@oubidar-Abderrahim i'm now hitting this error on GraalVM CE dev builds, using Micronaut v3. So we can eliminate Micronaut v4 as the culprit, probably. I'm still not sure what's causing the error, it just appears for certain combinations of flags.
Can you please provide additional details on how to reproduce this?
Locally, following your instructions, (./gradlew :packages:cli:nativeCompile), I get the following error:
kotlin version: 1.9.0 error message: java.lang.IllegalAccessError: superclass access check failed: class org.jetbrains.kotlin.kapt3.base.javac.KaptJavaCompiler (in unnamed module @0x3c1c9ae6) cannot access class com.sun.tools.javac.main.JavaCompiler (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.main to unnamed module @0x3c1c9ae6
@teshull you will need to clone from the micronaut4 branch, we've frozen it where it was failing:
git clone git@github.com:elide-dev/elide.git -b labs/express-opt-micronaut-v4
cd elide
./gradlew :packages:cli:nativeOptimizedCompile
@teshull / @oubidar-Abderrahim any update on this? we're building against dev/latest and it's still breaking :/ we're worried we may need to jump back, quick, if this isn't going to make it in by the Sept release
@teshull / @oubidar-Abderrahim with a small patch to GraalObjectReplacer.java
on master
:
From d569edebe065bceeac3501567b6aa071f173f530 Mon Sep 17 00:00:00 2001
From: Sam Gammon <sam@elide.ventures>
Date: Tue, 12 Sep 2023 20:19:34 -0700
Subject: [PATCH] fix: temp
---
.../com/oracle/svm/graal/hosted/GraalGraphObjectReplacer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/GraalGraphObjectReplacer.java b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/GraalGraphObjectReplacer.java
index 5a5d2d8c5a6..bc64e11c006 100644
--- a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/GraalGraphObjectReplacer.java
+++ b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/GraalGraphObjectReplacer.java
@@ -318,7 +318,7 @@ public class GraalGraphObjectReplacer implements Function<Object, Object> {
}
AnalysisType aType = toAnalysisType(original);
- VMError.guarantee(aType.isLinked(), "Types reachable for JIT compilation must not have linkage errors");
+ VMError.guarantee(aType.isLinked(), "Types reachable for JIT compilation must not have linkage errors: " + aType.toString());
SubstrateType sType = types.get(aType);
if (sType == null) {
VMError.guarantee(!(forbidNewTypes || (original instanceof HostedType)), "Too late to create a new type: %s", aType);
--
2.39.2 (Apple Git-143)
I can at least get some hint of what is not linking correctly:
Fatal error: com.oracle.svm.core.util.VMError$HostedError: Types reachable for JIT compilation must not have linkage errors: AnalysisType<Log4JLogger -> HotSpotType<Lio/netty/util/internal/logging/Log4JLogger;, resolved>, allocated: true, inHeap: false, reachable: true>
Which shows the type:
io/netty/util/internal/logging/Log4JLogger;
cc / @graemerocher does this make any sense from micronaut's perspective? we are using logback, so it's reasonable that log4j would not be present, i will try building with it to see if it makes a difference; recall that micronaut { runtime(NETTY) }
vs. runtime(NONE)
was seemingly related to this
Okay, an update, once I added the following, I can get it to build:
dependencies {
// ...
implementation(mn.micronaut.websocket)
implementation(libs.slf4j.log4j.bridge) // this is `org.slf4j:log4j-over-slf4j`
implementation(libs.netty.tcnative) // this is `io.netty:netty-tcnative`
implementation("org.eclipse.jetty.npn:npn-api:8.1.2.v20120308")
implementation("org.eclipse.jetty.alpn:alpn-api:1.1.3.v20160715")
}
Each dependency was resolved using that patch, since at least there is a type printed. Upon inspecting that type in IDEA, I can usually determine the transitive type that is failing to load.
I would be happy to offer a PR here, albeit for a one line change; the error could be formatted better, for sure, than my patch, but at the very least having something to grab on to with this particular error was very helpful in the diagnosis process.
@graemerocher we are using Netty, not Jetty, and a bunch of BOMs are pulled into our Micronaut v4 build if I add these deps; it seems like implementation
is required (I also tried compileOnly
). This is obviously an unstable build of GraalVM, but I just wanted you to be aware in case it (1) affects Micronaut in the upcoming Sept release or (2) factors into diagnosis on this issue.
I'm not sure why those particular dependencies weren't making it into the build. I've never had to add mn.micronaut.websocket
before for a native build to succeed. We aren't doing anything with Websockets.
Some other context for this issue, as relates to Micronaut:
We are building a Picocli app with an embedded Netty server -- slightly weird configuration which may contribute to the missing types or needed flags
I believe --enable-all-security-services
also must be enabled in native-image
We still need to build against dev
/master
for this to work; GVM latest release at 20.0.2
still fails and can't be patched to see what's triggering the issue (so, apparently, there are other deps needed, or some other issue aside from these fixes)
The app has worked fine the entire time running via JVM
Hi @sgammon, sorry for the delay. I'm glad you were able to resolve your issue. In the end it looks like it was an configuration issue, correct?
I'll add a message to the GraalObjectReplacer. In general, there is room for improvement in returning more informative/actionable error messages
@teshull Thank you and no worries. I think the real "bug" here is that we couldn't diagnose this, yeah. The missing dependencies may be informative for the Micronaut team, maybe they are intended to be there.
Stringifying the type that experienced the linkage issue isn't the nicest error, it's true, but at the very least it gave us a hint which helped us find each "missing" type. A fix would be awesome to get in to 24.x.x
if possible but I realize that release is imminent.
@teshull cc / @oubidar-Abderrahim congrats on the release! 🥳 this looks fixed, so I'll close, especially since there is an internal bug tracking the issue. Thank you for your help and hard work!
We are building an open source project which relies on GraalVM as the execution engine. As part of this project, we have a CLI target, which uses the main
graalvm
module (all Gradle modules). Upon upgrading to Micronaut v4, we've encountered this "JIT compilation must not have linkage errors" exception and cannot proceed any further.Things we've tried
1) Removing all possible native image build flags 2) Removing and re-adding all possible dependencies 3) Removing and re-adding all code
Building a pure hello-world sample with the
graalvm
module listed as a dependency is sufficient to cause the issue. Separately, we are building fine with Micronanut 4 and GraalVM (in other projects), so it's unclear why it's failing, and the exception stacktrace offers no hints about how to diagnose.