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

Cannot use FontManager on windows #945

Open
kristofdho opened this issue May 29, 2021 · 2 comments
Open

Cannot use FontManager on windows #945

kristofdho opened this issue May 29, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@kristofdho
Copy link
Contributor

GraalVM 21.1.0 introduces shim dll's to support a broader range of libraries, which are not yet statically linked into the image itself.
Without these shim dll's, the FontManager stuff does not work.

The attached project has a small reproducer which forces the FontManager to be initialized, set up to be built with the native-image-maven-plugin, and the gluon client-maven-plugin.

public class FontManagerPoc {
    public static void main(String[] args) {
        GraphicsEnvironment.getLocalGraphicsEnvironment().preferLocaleFonts();
        System.out.println("Ran without issues.");
    }
}

Expected Behavior

The fontmanager calls succeed, and Ran without issues. is printed to the console.

Current Behavior

Exception in thread "main" 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 java.awt.GraphicsEnvironment.preferLocaleFonts(GraphicsEnvironment.java:397)
        at org.example.FontManagerPoc.main(FontManagerPoc.java:7)
Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
        ... 4 more
Caused by: java.lang.InternalError: platform encoding not initialized
        at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_InternalError_2_0002e_0003cinit_0003e_00028Ljava_lang_String_2_00029V(JNIJavaCallWrappers.java:0)
        at com.oracle.svm.jni.functions.JNIFunctions$NewObjectWithObjectArrayArgFunctionPointer.invoke(JNIFunctions.java)
        at com.oracle.svm.jni.functions.JNIFunctions.ThrowNew(JNIFunctions.java:819)
        at sun.awt.Win32FontManager.getFontPath(Win32FontManager.java)
        at sun.font.SunFontManager.getPlatformFontPath(SunFontManager.java:3196)
        at sun.font.SunFontManager.getPlatformFontDirs(SunFontManager.java:3081)
        at sun.awt.Win32FontManager.getDefaultPlatformFont(Win32FontManager.java:218)
        at sun.font.SunFontManager$2.run(SunFontManager.java:381)
        at java.security.AccessController.doPrivileged(AccessController.java:82)
        at sun.font.SunFontManager.<init>(SunFontManager.java:324)
        at sun.awt.Win32FontManager.<init>(Win32FontManager.java:87)
        ... 6 more

Steps to Reproduce

fontmanager-project.zip

Unpack the attached project, and build it:

From GraalVM 21.1.0 onwards, this works out of the box, compiling with the native-image maven plugin. To verify, run:

mvn -Pgraalvm clean package native-image:native-image & target\FontManagerPoc.exe -D"java.home=<project root>\target"

Substitute <project root> with the actual location.

To run the Gluon counterpart, run:

mvn -Pgluon clean package client:build & target\client\x86_64-windows\FontManagerPoc.exe -D"java.home=<project root>\target\client\x86_64-windows"

Again substitute <project root>.

This however results in the stacktrace under Current Behavior.
The essence of the issue here is that some dlls need to be copy pasted next to the executable, which for now needs to be done manually. The project keeps these dlls in the gluon-extra-resources folder.
One of these dlls is java.dll, which is already statically linked in the native-image, and because of this, is not correctly initialized in its dll form.
While for using awt.dll this doesn't seem to be an issue, for using fontmanager.dll, is clearly is.

The platform encoding not initialized exception is thrown here deep in java.dll code.
Because the InitializeEncoding function is never called,
which normally gets called here in the System.initProperties native call, which will run the statically included call, not the one from java.dll.

Long story short, to fix this, there needs to be an equivalent of the shim dlls in substrate.

Your Environment

  • Windows 10
  • GraalVM 21.1.0
  • client maven plugin 0.1.41 -> substrate 0.0.39
@kristofdho kristofdho added the bug Something isn't working label May 29, 2021
@kristofdho
Copy link
Contributor Author

kristofdho commented Dec 1, 2022

With the following feature:

public class FontmanagerFeature implements Feature {
    @Override
    public void beforeAnalysis(BeforeAnalysisAccess access) {
        FeatureImpl.BeforeAnalysisAccessImpl a = ((FeatureImpl.BeforeAnalysisAccessImpl) access);
        PlatformNativeLibrarySupport.singleton().addBuiltinPkgNativePrefix("sun_font");
        PlatformNativeLibrarySupport.singleton().addBuiltinPkgNativePrefix("sun_java2d_loops_DrawGlyphList");
        PlatformNativeLibrarySupport.singleton().addBuiltinPkgNativePrefix("sun_awt_Win32FontManager_getFontPath");
        PlatformNativeLibrarySupport.singleton().addBuiltinPkgNativePrefix("sun_awt_Win32FontManager_populateFontFileNameMap0");

        NativeLibraries nativeLibraries = a.getNativeLibraries();
        NativeLibrarySupport.singleton().preregisterUninitializedBuiltinLibrary("fontmanager");
        NativeLibrarySupport.singleton().preregisterUninitializedBuiltinLibrary("freetype");
        nativeLibraries.addStaticJniLibrary("fontmanager", "awt");
        nativeLibraries.addStaticNonJniLibrary("freetype");
        nativeLibraries.addDynamicNonJniLibrary("gdi32");
    }
}

And this plugin config:

<nativeImageArgs>
    <arg>--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.hosted=ALL-UNNAMED
    </arg>
    <arg>--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.hosted.c=ALL-UNNAMED
    </arg>
    <arg>--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED
    </arg>
</nativeImageArgs>
<linkerArgs>
    <arg>fontmanager.lib</arg>
    <arg>freetype.lib</arg>
    <arg>gdi32.lib</arg>

    <!-- required for the shim dlls -->
    <!-- https://github.com/oracle/graal/issues/4072#issuecomment-1025211534 -->
    <!-- https://github.com/oracle/graal/blob/vm-ce-22.3.0/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JNIRegistrationAWTSupport.java#L45-L66 -->
    <arg>/export:JDK_LoadSystemLibrary</arg>
    <arg>/export:JNU_CallMethodByName</arg>
    <arg>/export:JNU_CallMethodByNameV</arg>
    <arg>/export:JNU_CallStaticMethodByName</arg>
    <arg>/export:JNU_ClassString</arg>
    <arg>/export:JNU_GetEnv</arg>
    <arg>/export:JNU_GetFieldByName</arg>
    <arg>/export:JNU_GetStaticFieldByName</arg>
    <arg>/export:JNU_IsInstanceOfByName</arg>
    <arg>/export:JNU_NewObjectByName</arg>
    <arg>/export:JNU_NewStringPlatform</arg>
    <arg>/export:JNU_SetFieldByName</arg>
    <arg>/export:JNU_ThrowArrayIndexOutOfBoundsException</arg>
    <arg>/export:JNU_ThrowByName</arg>
    <arg>/export:JNU_ThrowIOException</arg>
    <arg>/export:JNU_ThrowIllegalArgumentException</arg>
    <arg>/export:JNU_ThrowInternalError</arg>
    <arg>/export:JNU_ThrowNullPointerException</arg>
    <arg>/export:JNU_ThrowOutOfMemoryError</arg>
    <arg>/export:getEncodingFromLangID</arg>
    <arg>/export:getJavaIDFromLangID</arg>
    <arg>shell32.lib</arg>
</linkerArgs>

I almost have this working (I think).

If there is nothing of javafx on the classpath, it works with the addition of <arg>awt.lib</arg> to the <linkerArgs>. But in that case I wouldn't be using the gluonfx plugin..

If there is something from javafx on the classpath, I'm stuck on these linker issues:

[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(sunFont.obj) : error LNK2019: unresolved external symbol AccelGlyphCache_RemoveAllCellInfos referenced in function Java_sun_font_StrikeCache_freeIntMemory
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(DrawGlyphList.obj) : error LNK2019: unresolved external symbol SurfaceData_GetOps referenced in function drawGlyphList
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(DrawGlyphList.obj) : error LNK2019: unresolved external symbol SurfaceData_IntersectBounds referenced in function RefineBounds
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(DrawGlyphList.obj) : error LNK2019: unresolved external symbol GetNativePrim referenced in function Java_sun_java2d_loops_DrawGlyphListAA_DrawGlyphListAA
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(DrawGlyphList.obj) : error LNK2019: unresolved external symbol GrPrim_Sg2dGetCompInfo referenced in function drawGlyphList
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(DrawGlyphList.obj) : error LNK2019: unresolved external symbol GrPrim_Sg2dGetClip referenced in function drawGlyphList
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(DrawGlyphList.obj) : error LNK2019: unresolved external symbol GrPrim_Sg2dGetPixel referenced in function Java_sun_java2d_loops_DrawGlyphListAA_DrawGlyphListAA
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(DrawGlyphList.obj) : error LNK2019: unresolved external symbol GrPrim_Sg2dGetEaRGB referenced in function Java_sun_java2d_loops_DrawGlyphListAA_DrawGlyphListAA
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] fontmanager.lib(DrawGlyphList.obj) : error LNK2019: unresolved external symbol GrPrim_Sg2dGetLCDTextContrast referenced in function Java_sun_java2d_loops_DrawGlyphListLCD_DrawGlyphListLCD
[Thu Dec 01 11:02:30 CET 2022][INFO] [SUB] C:\Comsof\projects\Native Image\fontManager-poc\fontmanager-project\target\gluonfx\x86_64-windows\FontManagerPoc.exe : fatal error LNK1120: 9 unresolved externals
[Thu Dec 01 11:02:30 CET 2022][SEVERE] Process link failed with result: 1120

And in this case, I cannot add <arg>awt.lib</arg> which contains these symbols, because then I am left with these linker issues, because apparently prism_d3d.lib duplicates symbols from awt:

[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(awt_Toolkit.obj) : error LNK2005: DllMain already defined in net.lib(net_util_md.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DContext.obj) : error LNK2005: "void __cdecl D3DUtils_SetIdentityMatrix(struct _D3DMATRIX *)" (?D3DUtils_SetIdentityMatrix@@YAXPEAU_D3DMATRIX@@@Z) already defined in prism_d3d.lib(D3DContext.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DContext.obj) : error LNK2005: "public: long __cdecl D3DContext::EndScene(void)" (?EndScene@D3DContext@@QEAAJXZ) already defined in prism_d3d.lib(D3DContext.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DContext.obj) : error LNK2005: "private: long __cdecl D3DContext::InitContextCaps(void)" (?InitContextCaps@D3DContext@@AEAAJXZ) already defined in prism_d3d.lib(D3DContext.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DContext.obj) : error LNK2005: "private: long __cdecl D3DContext::InitDevice(struct IDirect3DDevice9 *)" (?InitDevice@D3DContext@@AEAAJPEAUIDirect3DDevice9@@@Z) already defined in prism_d3d.lib(D3DContext.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DContext.obj) : error LNK2005: "public: long __cdecl D3DContext::ResetClip(void)" (?ResetClip@D3DContext@@QEAAJXZ) already defined in prism_d3d.lib(D3DContext.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DContext.obj) : error LNK2005: "public: long __cdecl D3DContext::ResetContext(void)" (?ResetContext@D3DContext@@QEAAJXZ) already defined in prism_d3d.lib(D3DContextInit.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DContext.obj) : error LNK2005: "public: long __cdecl D3DContext::ResetTransform(void)" (?ResetTransform@D3DContext@@QEAAJXZ) already defined in prism_d3d.lib(D3DContext.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DContext.obj) : error LNK2005: "public: long __cdecl D3DContext::SetRectClip(int,int,int,int)" (?SetRectClip@D3DContext@@QEAAJHHHH@Z) already defined in prism_d3d.lib(D3DContext.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "private: long __cdecl D3DPipelineManager::CheckDeviceCaps(unsigned int)" (?CheckDeviceCaps@D3DPipelineManager@@AEAAJI@Z) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "private: long __cdecl D3DPipelineManager::D3DEnabledOnAdapter(unsigned int)" (?D3DEnabledOnAdapter@D3DPipelineManager@@AEAAJI@Z) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "int __cdecl D3DPPLM_OsVersionMatches(unsigned short)" (?D3DPPLM_OsVersionMatches@@YAHG@Z) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "public: long __cdecl D3DPipelineManager::GetD3DContext(unsigned int,class D3DContext * *)" (?GetD3DContext@D3DPipelineManager@@QEAAJIPEAPEAVD3DContext@@@Z) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "public: static class D3DPipelineManager * __cdecl D3DPipelineManager::GetInstance(void)" (?GetInstance@D3DPipelineManager@@SAPEAV1@XZ) already defined in prism_d3d.lib(D3DResourceFactory.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "public: enum _D3DFORMAT __cdecl D3DPipelineManager::GetMatchingDepthStencilFormat(unsigned int,enum _D3DFORMAT,enum _D3DFORMAT)" (?GetMatchingDepthStencilFormat@D3DPipelineManager@@QEAA?AW4_D3DFORMAT@@IW42@0@Z) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "private: long __cdecl D3DPipelineManager::ReleaseAdapters(void)" (?ReleaseAdapters@D3DPipelineManager@@AEAAJXZ) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "private: long __cdecl D3DPipelineManager::ReleaseD3D(void)" (?ReleaseD3D@D3DPipelineManager@@AEAAJXZ) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "private: enum _D3DDEVTYPE __cdecl D3DPipelineManager::SelectDeviceType(void)" (?SelectDeviceType@D3DPipelineManager@@AEAA?AW4_D3DDEVTYPE@@XZ) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DPipelineManager.obj) : error LNK2005: "private: static class D3DPipelineManager * D3DPipelineManager::pMgr" (?pMgr@D3DPipelineManager@@0PEAV1@EA) already defined in prism_d3d.lib(D3DPipelineManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "protected: virtual __cdecl D3DResource::~D3DResource(void)" (??1D3DResource@@MEAA@XZ) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "public: __cdecl D3DResourceManager::~D3DResourceManager(void)" (??1D3DResourceManager@@QEAA@XZ) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "public: long __cdecl D3DResourceManager::AddResource(class IManagedResource *)" (?AddResource@D3DResourceManager@@QEAAJPEAVIManagedResource@@@Z) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "private: long __cdecl D3DResourceManager::CreateOSPSurface(unsigned int,unsigned int,enum _D3DFORMAT,class D3DResource * *)" (?CreateOSPSurface@D3DResourceManager@@AEAAJIIW4_D3DFORMAT@@PEAPEAVD3DResource@@@Z) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "public: long __cdecl D3DResourceManager::CreateSwapChain(struct HWND__ *,unsigned int,unsigned int,unsigned int,enum _D3DSWAPEFFECT,unsigned int,class D3DResource * *)" (?CreateSwapChain@D3DResourceManager@@QEAAJPEAUHWND__@@IIIW4_D3DSWAPEFFECT@@IPEAPEAVD3DResource@@@Z) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "public: long __cdecl D3DResourceManager::GetBlitOSPSurface(unsigned int,unsigned int,enum _D3DFORMAT,class D3DResource * *)" (?GetBlitOSPSurface@D3DResourceManager@@QEAAJIIW4_D3DFORMAT@@PEAPEAVD3DResource@@@Z) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "protected: void __cdecl D3DResource::Init(struct IDirect3DResource9 *,struct IDirect3DSwapChain9 *)" (?Init@D3DResource@@IEAAXPEAUIDirect3DResource9@@PEAUIDirect3DSwapChain9@@@Z) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "public: virtual int __cdecl D3DResource::IsDefaultPool(void)" (?IsDefaultPool@D3DResource@@UEAAHXZ) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "protected: virtual void __cdecl D3DResource::Release(void)" (?Release@D3DResource@@MEAAXXZ) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "public: void __cdecl D3DResourceManager::ReleaseAll(void)" (?ReleaseAll@D3DResourceManager@@QEAAXXZ) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "public: void __cdecl D3DResourceManager::ReleaseDefPoolResources(void)" (?ReleaseDefPoolResources@D3DResourceManager@@QEAAXXZ) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(D3DResourceManager.obj) : error LNK2005: "public: long __cdecl D3DResourceManager::ReleaseResource(class IManagedResource *)" (?ReleaseResource@D3DResourceManager@@QEAAJPEAVIManagedResource@@@Z) already defined in prism_d3d.lib(D3DResourceManager.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(awt_DnDDS.obj) : error LNK2005: "bool __cdecl operator<(struct tagFORMATETC const &,struct tagFORMATETC const &)" (??M@YA_NAEBUtagFORMATETC@@0@Z) already defined in glass.lib(GlassClipboard.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] comsupp.lib(comutil.obj) : error LNK2005: "class _variant_t vtMissing" (?vtMissing@@3V_variant_t@@A) already defined in comsuppw.lib(comutil.obj)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB]    Creating library C:\Comsof\projects\Native Image\fontManager-poc\fontmanager-project\target\gluonfx\x86_64-windows\FontManagerPoc.lib and object C:\Comsof\projects\Native Image\fontManager-poc\fontmanager-project\target\gluonfx\x86_64-windows\FontManagerPoc.exp
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(awt_Toolkit.obj) : error LNK2019: unresolved external symbol __imp_StrTrimW referenced in function "private: void __cdecl AwtToolkit::InitTouchKeyboardExeFilePath(void)" (?InitTouchKeyboardExeFilePath@AwtToolkit@@AEAAXXZ)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(ComCtl32Util.obj) : error LNK2019: unresolved external symbol __imp_InitCommonControlsEx referenced in function "public: void __cdecl ComCtl32Util::InitLibraries(void)" (?InitLibraries@ComCtl32Util@@QEAAXXZ)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(ComCtl32Util.obj) : error LNK2019: unresolved external symbol SetWindowSubclass referenced in function "public: __int64 (__cdecl*__cdecl ComCtl32Util::SubclassHWND(struct HWND__ *,__int64 (__cdecl*)(struct HWND__ *,unsigned int,unsigned __int64,__int64)))(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?SubclassHWND@ComCtl32Util@@QEAAP6A_JPEAUHWND__@@I_K_J@Z0P6A_J0I12@Z@Z)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(ComCtl32Util.obj) : error LNK2019: unresolved external symbol RemoveWindowSubclass referenced in function "public: void __cdecl ComCtl32Util::UnsubclassHWND(struct HWND__ *,__int64 (__cdecl*)(struct HWND__ *,unsigned int,unsigned __int64,__int64),__int64 (__cdecl*)(struct HWND__ *,unsigned int,unsigned __int64,__int64))" (?UnsubclassHWND@ComCtl32Util@@QEAAXPEAUHWND__@@P6A_J0I_K_J@Z3@Z)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(ComCtl32Util.obj) : error LNK2019: unresolved external symbol DefSubclassProc referenced in function "public: __int64 __cdecl ComCtl32Util::DefWindowProcW(__int64 (__cdecl*)(struct HWND__ *,unsigned int,unsigned __int64,__int64),struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?DefWindowProcW@ComCtl32Util@@QEAA_JP6A_JPEAUHWND__@@I_K_J@Z0I12@Z)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] awt.lib(awt_DnDDT.obj) : error LNK2019: unresolved external symbol __imp_SHCreateStreamOnFileW referenced in function "protected: virtual long __cdecl AwtDropTarget::SaveIndexToFile(unsigned short const *,unsigned int)" (?SaveIndexToFile@AwtDropTarget@@MEAAJPEBGI@Z)
[Thu Dec 01 11:07:16 CET 2022][INFO] [SUB] C:\Comsof\projects\Native Image\fontManager-poc\fontmanager-project\target\gluonfx\x86_64-windows\FontManagerPoc.exe : fatal error LNK1120: 6 unresolved externals
[Thu Dec 01 11:07:16 CET 2022][SEVERE] Process link failed with result: 1120

Please note that:

  • Since it works with default native-image, I would like to contribute a version of that feature to GraalVM so fontmanager is officially supported and can be statically linked in. However I cannot do so before substrate also supports this.
  • I am still omitting a few steps to actually be able to run the image, as it needs shim dlls next to the image that are generated by native-image, but not by substrate.

@GenCloud
Copy link

any news for inject in javafx project awt.lib?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants