Closed
Description
Describe the issue
Generating a native-image that uses AWT is failing to generate the java.dll shim DLL.
Steps to reproduce the issue
Run native-image on very simple AWT example.
Describe GraalVM and your environment:
- GraalVM version 21.1 (also tried latest snapshots)
- JDK 16
- OS: Windows 10
- Architecture: AMD64
Here is the output from native-image with the -H:+TraceNativeToolUsage option added to show the error.
[main:4680] classlist: 1,179.12 ms, 0.96 GB
>> 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe'
># Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29913 for x64
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># usage: cl [ option... ] filename... [ /link linkoption... ]
>> 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe' /WX /W4 /wd4244 /wd4245 /wd4800 /wd4804 /wd4214 '/FeC:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\AArch64LibCHelperDirectives.exe' 'C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\AArch64LibCHelperDirectives.c'
># AArch64LibCHelperDirectives.c
># Microsoft (R) Incremental Linker Version 14.28.29913.0
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># /out:C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\AArch64LibCHelperDirectives.exe
># AArch64LibCHelperDirectives.obj
>> 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe' /WX /W4 /wd4244 /wd4245 /wd4800 /wd4804 /wd4214 '/FeC:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\BuiltinDirectives.exe' 'C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\BuiltinDirectives.c'
># BuiltinDirectives.c
># Microsoft (R) Incremental Linker Version 14.28.29913.0
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># /out:C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\BuiltinDirectives.exe
># BuiltinDirectives.obj
>> 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe' /WX /W4 /wd4244 /wd4245 /wd4800 /wd4804 /wd4214 '-IC:\bin\jdk\include\win32' '/FeC:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\JNIHeaderDirectives.exe' 'C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\JNIHeaderDirectives.c'
># JNIHeaderDirectives.c
># Microsoft (R) Incremental Linker Version 14.28.29913.0
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># /out:C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\JNIHeaderDirectives.exe
># JNIHeaderDirectives.obj
>> 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe' /WX /W4 /wd4244 /wd4245 /wd4800 /wd4804 /wd4214 '/FeC:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\AMD64LibCHelperDirectives.exe' 'C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\AMD64LibCHelperDirectives.c'
># AMD64LibCHelperDirectives.c
># Microsoft (R) Incremental Linker Version 14.28.29913.0
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># /out:C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\AMD64LibCHelperDirectives.exe
># AMD64LibCHelperDirectives.obj
>> 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe' /WX /W4 /wd4244 /wd4245 /wd4800 /wd4804 /wd4214 '/FeC:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\WindowsDirectives.exe' 'C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\WindowsDirectives.c'
># WindowsDirectives.c
># Microsoft (R) Incremental Linker Version 14.28.29913.0
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># /out:C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\WindowsDirectives.exe
># WindowsDirectives.obj
[main:4680] (cap): 1,598.24 ms, 0.96 GB
[main:4680] setup: 3,139.23 ms, 0.96 GB
[main:4680] (clinit): 280.17 ms, 1.76 GB
[main:4680] (typeflow): 9,026.50 ms, 1.76 GB
[main:4680] (objects): 5,199.15 ms, 1.76 GB
[main:4680] (features): 436.00 ms, 1.76 GB
[main:4680] analysis: 15,313.36 ms, 1.76 GB
[main:4680] universe: 569.92 ms, 1.76 GB
[main:4680] (parse): 1,760.88 ms, 1.76 GB
[main:4680] (inline): 3,694.32 ms, 2.32 GB
[main:4680] (compile): 18,411.18 ms, 2.85 GB
[main:4680] compile: 25,060.89 ms, 2.85 GB
[main:4680] image: 1,944.41 ms, 2.85 GB
>> 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe' '/Fec:\files\workspace\jf\projects\jfawt\main.dll' main.obj 'C:\bin\jdk\lib\svm\clibraries\windows-amd64\libchelper.lib' 'D:\bin\jdk\lib\static\windows-amd64\prefs.lib' 'D:\bin\jdk\lib\static\windows-amd64\net.lib' 'D:\bin\jdk\lib\static\windows-amd64\nio.lib' 'D:\bin\jdk\lib\static\windows-amd64\java.lib' 'D:\bin\jdk\lib\static\windows-amd64\fdlibm.lib' 'D:\bin\jdk\lib\static\windows-amd64\zip.lib' 'C:\bin\jdk\lib\svm\clibraries\windows-amd64\jvm.lib' /MD /LD 'C:\bin\jdk\lib\svm\clibraries\windows-amd64\libchelper.lib' 'D:\bin\jdk\lib\static\windows-amd64\prefs.lib' 'D:\bin\jdk\lib\static\windows-amd64\net.lib' 'D:\bin\jdk\lib\static\windows-amd64\nio.lib' 'D:\bin\jdk\lib\static\windows-amd64\java.lib' 'D:\bin\jdk\lib\static\windows-amd64\fdlibm.lib' 'D:\bin\jdk\lib\static\windows-amd64\zip.lib' 'C:\bin\jdk\lib\svm\clibraries\windows-amd64\jvm.lib' /link /INCREMENTAL:NO /NODEFAULTLIB:LIBCMT '/IMPLIB:C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\main.lib' '/LIBPATH:D:\bin\jdk\lib\static\windows-amd64' '/LIBPATH:C:\bin\jdk\lib\svm\clibraries\windows-amd64' version.lib advapi32.lib ws2_32.lib secur32.lib iphlpapi.lib userenv.lib /include:JDK_LoadSystemLibrary /include:getEncodingFromLangID /include:getJavaIDFromLangID shell32.lib
># Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29913 for x64
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># Microsoft (R) Incremental Linker Version 14.28.29913.0
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># /out:c:\files\workspace\jf\projects\jfawt\main.dll
># /dll
># /implib:c:\files\workspace\jf\projects\jfawt\main.lib
># /INCREMENTAL:NO
># /NODEFAULTLIB:LIBCMT
># /IMPLIB:C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\main.lib
># /LIBPATH:D:\bin\jdk\lib\static\windows-amd64
># /LIBPATH:C:\bin\jdk\lib\svm\clibraries\windows-amd64
># version.lib
># advapi32.lib
># ws2_32.lib
># secur32.lib
># iphlpapi.lib
># userenv.lib
># /include:JDK_LoadSystemLibrary
># /include:getEncodingFromLangID
># /include:getJavaIDFromLangID
># shell32.lib
># main.obj
># C:\bin\jdk\lib\svm\clibraries\windows-amd64\libchelper.lib
># D:\bin\jdk\lib\static\windows-amd64\prefs.lib
># D:\bin\jdk\lib\static\windows-amd64\net.lib
># D:\bin\jdk\lib\static\windows-amd64\nio.lib
># D:\bin\jdk\lib\static\windows-amd64\java.lib
># D:\bin\jdk\lib\static\windows-amd64\fdlibm.lib
># D:\bin\jdk\lib\static\windows-amd64\zip.lib
># C:\bin\jdk\lib\svm\clibraries\windows-amd64\jvm.lib
># C:\bin\jdk\lib\svm\clibraries\windows-amd64\libchelper.lib
># D:\bin\jdk\lib\static\windows-amd64\prefs.lib
># D:\bin\jdk\lib\static\windows-amd64\net.lib
># D:\bin\jdk\lib\static\windows-amd64\nio.lib
># D:\bin\jdk\lib\static\windows-amd64\java.lib
># D:\bin\jdk\lib\static\windows-amd64\fdlibm.lib
># D:\bin\jdk\lib\static\windows-amd64\zip.lib
># C:\bin\jdk\lib\svm\clibraries\windows-amd64\jvm.lib
># Creating library C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\main.lib and object C:\Users\pquiring\AppData\Local\Temp\SVM-13019833656975526458\main.exp
>> 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX64\x64\cl.exe' '/Fec:\files\workspace\jf\projects\jfawt\java.dll' 'c:\files\workspace\jf\projects\jfawt\main.lib' msvcrt.lib /link /dll /implib:java.lib /export:JDK_LoadSystemLibrary /export:JNU_CallMethodByName /export:JNU_CallMethodByNameV /export:JNU_CallStaticMethodByName /export:JNU_ClassString /export:JNU_GetEnv /export:JNU_GetFieldByName /export:JNU_GetStaticFieldByName /export:JNU_IsInstanceOfByName /export:JNU_NewObjectByName /export:JNU_NewStringPlatform /export:JNU_SetFieldByName /export:JNU_ThrowArrayIndexOutOfBoundsException /export:JNU_ThrowByName /export:JNU_ThrowIOException /export:JNU_ThrowIllegalArgumentException /export:JNU_ThrowInternalError /export:JNU_ThrowNullPointerException /export:JNU_ThrowOutOfMemoryError /export:getEncodingFromLangID /export:getJavaIDFromLangID /export:jio_snprintf
># Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29913 for x64
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># Microsoft (R) Incremental Linker Version 14.28.29913.0
># Copyright (C) Microsoft Corporation. All rights reserved.
>#
># /out:c:\files\workspace\jf\projects\jfawt\java.dll
># /dll
># /implib:java.lib
># /export:JDK_LoadSystemLibrary
># /export:JNU_CallMethodByName
># /export:JNU_CallMethodByNameV
># /export:JNU_CallStaticMethodByName
># /export:JNU_ClassString
># /export:JNU_GetEnv
># /export:JNU_GetFieldByName
># /export:JNU_GetStaticFieldByName
># /export:JNU_IsInstanceOfByName
># /export:JNU_NewObjectByName
># /export:JNU_NewStringPlatform
># /export:JNU_SetFieldByName
># /export:JNU_ThrowArrayIndexOutOfBoundsException
># /export:JNU_ThrowByName
># /export:JNU_ThrowIOException
># /export:JNU_ThrowIllegalArgumentException
># /export:JNU_ThrowInternalError
># /export:JNU_ThrowNullPointerException
># /export:JNU_ThrowOutOfMemoryError
># /export:getEncodingFromLangID
># /export:getJavaIDFromLangID
># /export:jio_snprintf
># c:\files\workspace\jf\projects\jfawt\main.lib
># msvcrt.lib
># LINK : warning LNK4001: no object files specified; libraries used
># LINK : warning LNK4068: /MACHINE not specified; defaulting to X64
># LINK : error LNK2001: unresolved external symbol JDK_LoadSystemLibrary
># LINK : error LNK2001: unresolved external symbol JNU_CallMethodByName
># LINK : error LNK2001: unresolved external symbol JNU_CallMethodByNameV
># LINK : error LNK2001: unresolved external symbol JNU_CallStaticMethodByName
># LINK : error LNK2001: unresolved external symbol JNU_ClassString
># LINK : error LNK2001: unresolved external symbol JNU_GetEnv
># LINK : error LNK2001: unresolved external symbol JNU_GetFieldByName
># LINK : error LNK2001: unresolved external symbol JNU_GetStaticFieldByName
># LINK : error LNK2001: unresolved external symbol JNU_IsInstanceOfByName
># LINK : error LNK2001: unresolved external symbol JNU_NewObjectByName
># LINK : error LNK2001: unresolved external symbol JNU_NewStringPlatform
># LINK : error LNK2001: unresolved external symbol JNU_SetFieldByName
># LINK : error LNK2001: unresolved external symbol JNU_ThrowArrayIndexOutOfBoundsException
># LINK : error LNK2001: unresolved external symbol JNU_ThrowByName
># LINK : error LNK2001: unresolved external symbol JNU_ThrowIOException
># LINK : error LNK2001: unresolved external symbol JNU_ThrowIllegalArgumentException
># LINK : error LNK2001: unresolved external symbol JNU_ThrowInternalError
># LINK : error LNK2001: unresolved external symbol JNU_ThrowNullPointerException
># LINK : error LNK2001: unresolved external symbol JNU_ThrowOutOfMemoryError
># java.lib : fatal error LNK1120: 19 unresolved externals
[main:4680] write: 771.12 ms, 2.85 GB
Fatal error:com.oracle.svm.core.util.VMError$HostedError: should not reach here
at com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:64)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimDLL(JNIRegistrationSupport.java:248)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimDLLs(JNIRegistrationSupport.java:222)
at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.afterImageWrite(JNIRegistrationSupport.java:167)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$doRun$12(NativeImageGenerator.java:716)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:71)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:716)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$2(NativeImageGenerator.java:495)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1414)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:295)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Error: Image build request failed with exit status 1
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
pquiring commentedon May 9, 2021
This seems to be related to JDK16, with JDK11 it compiles but still get exception when trying to run:
(and yes, I run thru the agent process to generate JNI config files - does it automatically use them?)
munishchouhan commentedon May 10, 2021
@pquiring please provide the reproducer
pquiring commentedon May 10, 2021
Just a very simple AWT test (JFrame with one JButton):
munishchouhan commentedon May 11, 2021
@pquiring thanks for the reproducer
munishchouhan commentedon May 11, 2021
@pquiring I have tried the reproducer and I am able to build it, But there are errors while running it, which is currently being resolved by our team. please check the following issues:#2835 and #2545
In case you require any other information, please let me know
Console output:
munishchouhan commentedon May 11, 2021
@pquiring i used GraalVM-21.2.0-dev
https://github.com/graalvm/graalvm-ce-dev-builds/releases/tag/21.2.0-dev-20210510_1948
pquiring commentedon May 11, 2021
Ok, I will wait for 21.2 and check progress then.
Thanks,
munishchouhan commentedon May 12, 2021
@pquiring ok thanks for the response closing this issue now.
Once #2835 and #2545 resolved, please try again
and if you still face the problem, please create an issue
pquiring commentedon May 17, 2021
FYI - That InvocationTargetException can be fixed by copying
${java.home}\lib\*font*
to.\lib
in app folder. Then this simple test works ;)srnagar commentedon Jul 19, 2021
I am running into a similar issue with 21.3.0 dev build for Windows. I tried this with 21.1.0 initially and got the same error.
mageddo commentedon Mar 14, 2023
I'm still getting this very same issue on graalvm 22.3.1 so why is this issue closed? , see my comment on this another thread: #4563 (comment)