Describe the issue
When building a native image on Windows with -H:+ForeignAPISupport and --enable-native-access=ALL-UNNAMED, the build fails during the afterImageWrite phase with:
com.oracle.svm.shared.util.VMError$HostedError: should not reach here: unexpected input could not be handled: 2
at com.oracle.svm.shared.util.VMError.shouldNotReachHereUnexpectedInput(VMError.java:140)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimLibrary(JNIRegistrationSupport.java:510)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimLibraries(JNIRegistrationSupport.java:456)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.afterImageWrite(JNIRegistrationSupport.java:306)
The image compilation itself completes successfully (all 8 stages), but the shim library creation fails. The build works fine on Linux and macOS.
Steps to reproduce
- Use Oracle GraalVM 25.1.3 on Windows
- Build a native image with these flags:
--enable-native-access=ALL-UNNAMED
-H:+ForeignAPISupport
- Include foreign downcall registrations in reachability-metadata.json, e.g.:
{
"foreign": {
"downcalls": [
{"returnType": "jlong", "parameterTypes": ["jlong"]},
{"returnType": "jlong", "parameterTypes": ["jlong", "jlong"]},
{"returnType": "void", "parameterTypes": ["jlong"]}
]
}
}
GraalVM version and target
- GraalVM version: Oracle GraalVM 25.1.3+9.1 (Java 25.0.3+9-LTS)
- OS: Windows (GitHub Actions
windows-2022 runner)
- C compiler: cl.exe (microsoft, x64, 19.44.35228)
- Architecture: x86-64
More details
The error occurs in the Windows-specific shim library generation code path. The makeShimLibrary method encounters an unexpected input value of 2 that it cannot handle, suggesting a missing case in a switch or conditional for a library type introduced by the foreign function support.
Full error report: https://github.com/infinispan/infinispan/actions/runs/29005045857/job/86074536310?pr=17766
Describe the issue
When building a native image on Windows with
-H:+ForeignAPISupportand--enable-native-access=ALL-UNNAMED, the build fails during theafterImageWritephase with:The image compilation itself completes successfully (all 8 stages), but the shim library creation fails. The build works fine on Linux and macOS.
Steps to reproduce
--enable-native-access=ALL-UNNAMED-H:+ForeignAPISupport{ "foreign": { "downcalls": [ {"returnType": "jlong", "parameterTypes": ["jlong"]}, {"returnType": "jlong", "parameterTypes": ["jlong", "jlong"]}, {"returnType": "void", "parameterTypes": ["jlong"]} ] } }GraalVM version and target
windows-2022runner)More details
The error occurs in the Windows-specific shim library generation code path. The
makeShimLibrarymethod encounters an unexpected input value of2that it cannot handle, suggesting a missing case in a switch or conditional for a library type introduced by the foreign function support.Full error report: https://github.com/infinispan/infinispan/actions/runs/29005045857/job/86074536310?pr=17766