Closed avimalka closed 1 year ago
Which version of OkHttp are you on? 4.10?
I can bump the version in 4.10.1? and see if that fixes this.
Thanks for reporting.
I'm using 5.0.0-alpha.5. Should I use version 4. ? the documentation says version 5. should be used for Graalvm native-image
Yep, can you try alpha.10? I'll check this week.
alpha.10 has the same error
Testing with https://github.com/square/okhttp/pull/7409
Looks like a common problem affecting frameworks like Quarkus. Two workarounds
1) export USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false 2) Add options
-J--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jni=ALL-UNNAMED
-J--add-exports=org.graalvm.sdk/org.graalvm.nativeimage.impl=ALL-UNNAMED
-J--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED
-J--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.localization=ALL-UNNAMED
-J--add-exports=org.graalvm.nativeimage.base/com.oracle.svm.util=ALL-UNNAMED
Raised https://github.com/oracle/graal/issues/4787 for a build failure on one target, but okcurl is building, so partially working.
USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM seems like the current fix. We are now on 22.3.0
I'm afraid using USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM
is only a temporary workaround as it will soon be removed. It seems OkHttpFeature.kt
is still depending on internal GraalVM Native Image API:
Instead, the feature should use RuntimeResourceAccess
and other classes of the public GraalVM SDK that we introduced in 22.3. Note that AutomaticFeature
is not part of the public API. Instead, I think the feature can add itself with --feature=okhttp3.internal.graal.OkHttpFeature
via its native-image.properties
.
@fniephaus I'll take a look, that's for the detailed pointers.
@yschimke I still got this issue, with graalvm 22.3.1, jdk19. okhttp 5.0.--alpha.11
will need the next alpha release https://github.com/square/okhttp/issues/7883
Snapshots are available if you want to test, or it's really blocking you
Hi,
When trying to build mockwebserver with native image on Graal 22.2 it fails with the following:
Older version works perfectly. Any workaround / solution for this ?