Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[native-image] makeShimDLL for java.dll is missing exports and fails #3393

Closed
pquiring opened this issue May 7, 2021 · 11 comments
Closed

[native-image] makeShimDLL for java.dll is missing exports and fails #3393

pquiring opened this issue May 7, 2021 · 11 comments
Assignees

Comments

@pquiring
Copy link

pquiring commented May 7, 2021

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
@pquiring
Copy link
Author

pquiring commented 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?)

Exception in thread "main" java.lang.NoSuchMethodError: java.awt.Toolkit.getDefaultToolkit()Ljava/awt/Toolkit;
        at com.oracle.svm.jni.functions.JNIFunctions$Support.getMethodID(JNIFunctions.java:1113)
        at com.oracle.svm.jni.functions.JNIFunctions$Support.getMethodID(JNIFunctions.java:1098)
        at com.oracle.svm.jni.functions.JNIFunctions.GetStaticMethodID(JNIFunctions.java:417)
        at java.awt.Toolkit.initIDs(Toolkit.java)
        at java.awt.Toolkit.<clinit>(Toolkit.java:1417)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
        at java.awt.Component.<clinit>(Component.java:624)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
        at java.lang.Class.ensureInitialized(DynamicHub.java:553)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:260)
        at java.lang.Class.ensureInitialized(DynamicHub.java:553)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:260)
        at java.lang.Class.ensureInitialized(DynamicHub.java:553)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:260)
        at java.lang.Class.ensureInitialized(DynamicHub.java:553)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:260)
        at java.lang.Class.ensureInitialized(DynamicHub.java:553)
        at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:260)

@munishchouhan
Copy link
Contributor

@pquiring please provide the reproducer

@munishchouhan munishchouhan self-assigned this May 10, 2021
@pquiring
Copy link
Author

pquiring commented May 10, 2021

Just a very simple AWT test (JFrame with one JButton):

public class Main extends javax.swing.JFrame {

  public Main() {
    initComponents();
  }

  @SuppressWarnings("unchecked")
  private void initComponents() {

    jButton1 = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jButton1.setText("Test");

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addContainerGap()
        .addComponent(jButton1)
        .addContainerGap(337, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
        .addContainerGap()
        .addComponent(jButton1)
        .addContainerGap(266, Short.MAX_VALUE))
    );

    pack();
  }

  public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
        new Main().setVisible(true);
      }
    });
  }

  private javax.swing.JButton jButton1;

}

@munishchouhan
Copy link
Contributor

@pquiring thanks for the reproducer

@munishchouhan
Copy link
Contributor

@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:

java -agentlib:native-image-agent=config-output-dir=META-INF/native-image Main

C:\Users\mchouhan\Desktop\github\3393>native-image --no-fallback Main
[main:17500]    classlist:     860.10 ms,  0.96 GB
[main:17500]        (cap):  12,383.13 ms,  0.96 GB
[main:17500]        setup:  14,263.49 ms,  0.96 GB
[main:17500]     (clinit):     416.94 ms,  4.57 GB
[main:17500]   (typeflow):  15,217.84 ms,  4.57 GB
[main:17500]    (objects):  12,979.61 ms,  4.57 GB
[main:17500]   (features):   1,263.82 ms,  4.57 GB
[main:17500]     analysis:  30,717.84 ms,  4.57 GB
[main:17500]     universe:     811.84 ms,  4.57 GB
[main:17500]      (parse):   2,312.21 ms,  4.57 GB
[main:17500]     (inline):   4,696.85 ms,  5.53 GB
[main:17500]    (compile):  13,062.77 ms,  5.49 GB
[main:17500]      compile:  21,545.85 ms,  5.49 GB
[main:17500]        image:   2,933.19 ms,  5.52 GB
[main:17500]        write:   4,487.08 ms,  5.52 GB
# Printing build artifacts to: C:\Users\mchouhan\Desktop\github\3393\main.build_artifacts.txt
[main:17500]      [total]:  76,183.67 ms,  5.52 GB

C:\Users\mchouhan\Desktop\github\3393>main                           
Exception in thread "AWT-EventQueue-0" java.lang.InternalError: java.lang.reflect.InvocationTargetException
        at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
        at java.security.AccessController.doPrivileged(AccessController.java:82)
        at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
        at sun.font.SunFontManager.getInstance(SunFontManager.java:249)
        at sun.font.FontDesignMetrics.getMetrics(FontDesignMetrics.java:265)
        at sun.swing.SwingUtilities2.getFontMetrics(SwingUtilities2.java:1243)
        at javax.swing.JComponent.getFontMetrics(JComponent.java:1646)
        at javax.swing.plaf.basic.BasicGraphicsUtils.getPreferredButtonSize(BasicGraphicsUtils.java:351)
        at javax.swing.plaf.basic.BasicButtonUI.getPreferredSize(BasicButtonUI.java:474)
        at javax.swing.plaf.basic.BasicButtonUI.getMinimumSize(BasicButtonUI.java:464)
        at javax.swing.JComponent.getMinimumSize(JComponent.java:1760)
        at javax.swing.GroupLayout$ComponentSpring.calculateNonlinkedMinimumSize(GroupLayout.java:3011)
        at javax.swing.GroupLayout$ComponentSpring.calculateMinimumSize(GroupLayout.java:2975)
        at javax.swing.GroupLayout$Spring.getMinimumSize(GroupLayout.java:1339)
        at javax.swing.GroupLayout$ComponentSpring.calculatePreferredSize(GroupLayout.java:2982)
        at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1349)
        at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1641)
        at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1628)
        at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1605)
        at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1349)
        at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1641)
        at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1625)
        at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1605)
        at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1349)
        at javax.swing.GroupLayout$Group.getSpringSize(GroupLayout.java:1641)
        at javax.swing.GroupLayout$Group.calculateSize(GroupLayout.java:1625)
        at javax.swing.GroupLayout$Group.calculatePreferredSize(GroupLayout.java:1605)
        at javax.swing.GroupLayout$Spring.getPreferredSize(GroupLayout.java:1349)
        at javax.swing.GroupLayout.calculateAutopadding(GroupLayout.java:1075)
        at javax.swing.GroupLayout.prepare(GroupLayout.java:1062)
        at javax.swing.GroupLayout.preferredLayoutSize(GroupLayout.java:882)
        at java.awt.Container.preferredSize(Container.java:1823)
        at java.awt.Container.getPreferredSize(Container.java:1807)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1682)
        at javax.swing.JRootPane$RootLayout.preferredLayoutSize(JRootPane.java:866)
        at java.awt.Container.preferredSize(Container.java:1823)
        at java.awt.Container.getPreferredSize(Container.java:1807)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1682)
        at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:724)
        at java.awt.Container.preferredSize(Container.java:1823)
        at java.awt.Container.getPreferredSize(Container.java:1807)
        at java.awt.Window.pack(Window.java:826)
        at Main.initComponents(Main.java:33)
        at Main.<init>(Main.java:4)
        at Main$1.run(Main.java:39)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
        at java.awt.EventQueue$4.run(EventQueue.java:721)
        at java.awt.EventQueue$4.run(EventQueue.java:715)
        at java.security.AccessController.doPrivileged(AccessController.java:100)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
        at com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:138)
Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
        ... 59 more
Caused by: java.lang.Error: java.home property not set
        at sun.awt.FontConfiguration.findFontConfigFile(FontConfiguration.java:182)
        at sun.awt.FontConfiguration.<init>(FontConfiguration.java:99)
        at sun.awt.windows.WFontConfiguration.<init>(WFontConfiguration.java:41)
        at sun.awt.Win32FontManager.createFontConfiguration(Win32FontManager.java:179)
        at sun.font.SunFontManager$2.run(SunFontManager.java:379)
        at java.security.AccessController.doPrivileged(AccessController.java:82)
        at sun.font.SunFontManager.<init>(SunFontManager.java:324)
        at sun.awt.Win32FontManager.<init>(Win32FontManager.java:87)
        ... 61 more

@munishchouhan
Copy link
Contributor

@pquiring
Copy link
Author

Ok, I will wait for 21.2 and check progress then.
Thanks,

@munishchouhan
Copy link
Contributor

@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
Copy link
Author

pquiring commented 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
Copy link

srnagar commented 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.

[native-tests.exe:14792]     (clinit):   1,974.52 ms,  5.74 GB
[native-tests.exe:14792]   (typeflow):  80,442.53 ms,  5.74 GB
[native-tests.exe:14792]    (objects):  93,848.44 ms,  5.74 GB
[native-tests.exe:14792]   (features):   6,216.15 ms,  5.74 GB
[native-tests.exe:14792]     analysis: 186,395.52 ms,  5.74 GB
[native-tests.exe:14792]     universe:   9,618.77 ms,  5.69 GB
[native-tests.exe:14792]      (parse):   6,683.03 ms,  5.75 GB
[native-tests.exe:14792]     (inline):  26,492.49 ms,  6.07 GB
[native-tests.exe:14792]    (compile):  77,599.75 ms,  6.45 GB
[native-tests.exe:14792]      compile: 116,356.37 ms,  6.45 GB
[native-tests.exe:14792]        image:  10,807.31 ms,  6.47 GB
[native-tests.exe:14792]        write:   4,710.06 ms,  6.47 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:256)
        at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.makeShimDLLs(JNIRegistrationSupport.java:230)
        at com.oracle.svm.hosted.jdk.JNIRegistrationSupport.afterImageWrite(JNIRegistrationSupport.java:175)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$doRun$8(NativeImageGenerator.java:664)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:73)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:664)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:489)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:398)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:561)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:120)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:591)
[native-tests.exe:14792]      [total]: 347,765.69 ms,  6.47 GB

@mageddo
Copy link

mageddo commented Mar 14, 2023

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.

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants