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

Trying to do Windows Implementation of Vmone #7

Open
wants to merge 69 commits into
base: main
Choose a base branch
from

Conversation

ctoabidmaqbool
Copy link

I am done with most of the things!

Yet, there are some little problem, which need to be fixed!

  1. gvm-24-1-windows-x64.zip contains absolute path which can't be easily extract with ar.exe or lib.exe. As there is no such drive D:/ in github actions runner (windows container)
    $ ar t libjdk.lib
    d:/a/mobile/mobile/build/windows-x64/support/native/java.base/libjava/static/AccessController.obj
    d:/a/mobile/mobile/build/windows-x64/support/native/java.base/libjava/static/Array.obj
    d:/a/mobile/mobile/build/windows-x64/support/native/java.base/libjava/static/BootLoader.obj
    ...
    
  2. The linux alternative gvm-24-1-linux-x64.zip contains only .o files not *.lib.res so shuld these files will be added up to final vmone.lib for windows?
  3. There are almost 657 files in libjdk.a file but 1016 files are in libjdk.lib, why?
  4. Even in my local mashine I am able to get vmone.lib, But still It have many issues:

process-compile-1726634934329.log
process-link-1726634936148.log

I alreay have disscussed most of the things here: gluonhq/substrate#1279 (comment)

…1: C:toolsmsys64usrbinbash.exe: command not found
and remove all others jobs except windwos-64 bit to focus on windows only!
@ctoabidmaqbool
Copy link
Author

substrate-fork to do testing vmone for windows!

@jperedadnr
Copy link
Contributor

You will get one step closer if you restore something that was removed, probably by mistake, in Substrate:
gluonhq/substrate@f93489a#diff-6671afa2eae21f712d1059fa9bfc797c2c04140ac9c9e5fbe9913fdfc2137abbL50

Just add to the WindowsTargetConfiguration:

private static final List<String> javaWindowsLibs = List.of(
            "advapi32", "iphlpapi", "secur32", "userenv",
            "version", "ws2_32", "winhttp", "ncrypt",
            "crypt32", "mswsock"
    );

    @Override
    List<String> getOtherStaticLibs() {
        return javaWindowsLibs;
    }

With that I get down to 15 unresolved symbols...

@ctoabidmaqbool
Copy link
Author

@jperedadnr Thanks, Using your provided help, I have getup much progress!

Process
=======
link

Command Line
============
link D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\gvm\HelloGluon\launcher.obj D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\gvm\tmp\SVM-1726700354384\com.gluonhq.hello.hellogluonapp.obj D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\gvm\HelloGluon\IconGroup.obj vmone.lib advapi32.lib iphlpapi.lib secur32.lib userenv.lib version.lib ws2_32.lib winhttp.lib ncrypt.lib crypt32.lib mswsock.lib /NODEFAULTLIB:libcmt.lib /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup comdlg32.lib dwmapi.lib gdi32.lib imm32.lib shell32.lib uiautomationcore.lib urlmon.lib winmm.lib javafx_font.lib javafx_iio.lib prism_common.lib /WHOLEARCHIVE:javafx_font.lib /WHOLEARCHIVE:javafx_iio.lib /WHOLEARCHIVE:prism_common.lib prism_sw.lib /WHOLEARCHIVE:prism_sw.lib /OUT:D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.exe /LIBPATH:C:\Users\MSC-30\.gluon\substrate\javafxStaticSdk\24-ea+7.1\windows-x86_64\sdk\lib /LIBPATH:C:\Users\MSC-30\.gluon\substrate\javaStaticSdk\24-4\windows-x86_64\lib

Output
======
Microsoft (R) Incremental Linker Version 14.39.33523.0
Copyright (C) Microsoft Corporation.  All rights reserved.

vmone.lib(awt_Toolkit.obj) : error LNK2005: DllMain already defined in vmone.lib(net_util_md.obj)
   Creating library D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.lib and object D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.exp
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol sysconf referenced in function JVM_ActiveProcessorCount
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol __errno referenced in function JVM_Connect
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol __getreent referenced in function JVM_FindLibraryEntry
vmone.lib(cpuid.o) : error LNK2001: unresolved external symbol __getreent
vmone.lib(dummy.o) : error LNK2001: unresolved external symbol __getreent
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol dlsym referenced in function JVM_FindLibraryEntry
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol ioctl referenced in function JVM_SocketAvailable
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol gettimeofday referenced in function Java_java_lang_System_currentTimeMillis
vmone.lib(JvmFuncs.o) : error LNK2001: unresolved external symbol __svm_vm_is_static_binary
vmone.lib(cpuid.o) : error LNK2019: unresolved external symbol ___chkstk_ms referenced in function checkCPUFeatures
vmone.lib(awt_Toolkit.obj) : error LNK2019: unresolved external symbol JVM_RaiseSignal referenced in function "public: static __int64 __cdecl AwtToolkit::WndProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?WndProc@AwtToolkit@@SA_JPEAUHWND__@@I_K_J@Z)
vmone.lib(awt_Toolkit.obj) : error LNK2019: unresolved external symbol __imp_StrTrimW referenced in function "private: void __cdecl AwtToolkit::InitTouchKeyboardExeFilePath(void)" (?InitTouchKeyboardExeFilePath@AwtToolkit@@AEAAXXZ)
vmone.lib(ComCtl32Util.obj) : error LNK2019: unresolved external symbol __imp_InitCommonControlsEx referenced in function "public: void __cdecl ComCtl32Util::InitLibraries(void)" (?InitLibraries@ComCtl32Util@@QEAAXXZ)
vmone.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)
vmone.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)
vmone.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)
vmone.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)
D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.exe : fatal error LNK1120: 15 unresolved externals


Result
======
result: 1120

@ctoabidmaqbool
Copy link
Author

ctoabidmaqbool commented Sep 19, 2024

vmone.lib(awt_Toolkit.obj) : error LNK2005: DllMain already defined in vmone.lib(net_util_md.obj)

This is the problem with libjdk.lib (windows-x64.zip) which was merged to vmone.lib.

What about this?

@ctoabidmaqbool
Copy link
Author

ctoabidmaqbool/substrate-fork@886f29b

@jperedadnr After necessory changes, Now!

Process
=======
link

Command Line
============
link D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\gvm\HelloGluon\launcher.obj D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\gvm\tmp\SVM-1726700354384\com.gluonhq.hello.hellogluonapp.obj D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\gvm\HelloGluon\IconGroup.obj vmone.lib advapi32.lib iphlpapi.lib secur32.lib userenv.lib version.lib ws2_32.lib winhttp.lib ncrypt.lib crypt32.lib mswsock.lib shlwapi.lib comctl32.lib /NODEFAULTLIB:libcmt.lib /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup comdlg32.lib dwmapi.lib gdi32.lib imm32.lib shell32.lib uiautomationcore.lib urlmon.lib winmm.lib javafx_font.lib javafx_iio.lib prism_common.lib /WHOLEARCHIVE:javafx_font.lib /WHOLEARCHIVE:javafx_iio.lib /WHOLEARCHIVE:prism_common.lib prism_sw.lib /WHOLEARCHIVE:prism_sw.lib /OUT:D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.exe /LIBPATH:C:\Users\MSC-30\.gluon\substrate\javafxStaticSdk\24-ea+7.1\windows-x86_64\sdk\lib /LIBPATH:C:\Users\MSC-30\.gluon\substrate\javaStaticSdk\24-4\windows-x86_64\lib

Output
======
Microsoft (R) Incremental Linker Version 14.39.33523.0
Copyright (C) Microsoft Corporation.  All rights reserved.

vmone.lib(awt_Toolkit.obj) : error LNK2005: DllMain already defined in vmone.lib(net_util_md.obj)
   Creating library D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.lib and object D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.exp
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol sysconf referenced in function JVM_ActiveProcessorCount
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol __errno referenced in function JVM_Connect
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol __getreent referenced in function JVM_FindLibraryEntry
vmone.lib(cpuid.o) : error LNK2001: unresolved external symbol __getreent
vmone.lib(dummy.o) : error LNK2001: unresolved external symbol __getreent
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol dlsym referenced in function JVM_FindLibraryEntry
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol ioctl referenced in function JVM_SocketAvailable
vmone.lib(JvmFuncs.o) : error LNK2019: unresolved external symbol gettimeofday referenced in function Java_java_lang_System_currentTimeMillis
vmone.lib(JvmFuncs.o) : error LNK2001: unresolved external symbol __svm_vm_is_static_binary
vmone.lib(cpuid.o) : error LNK2019: unresolved external symbol ___chkstk_ms referenced in function checkCPUFeatures
vmone.lib(awt_Toolkit.obj) : error LNK2019: unresolved external symbol JVM_RaiseSignal referenced in function "public: static __int64 __cdecl AwtToolkit::WndProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)" (?WndProc@AwtToolkit@@SA_JPEAUHWND__@@I_K_J@Z)
D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.exe : fatal error LNK1120: 9 unresolved externals


Result
======
result: 1120

@johanvos
Copy link
Contributor

ioctl etc are systemcalls in unix-like OS'es, but they don't exist on Windows. So those parts should have their Windows-specific equivalent.

@ctoabidmaqbool
Copy link
Author

ioctl etc are systemcalls in unix-like OS'es, but they don't exist on Windows. So those parts should have their Windows-specific equivalent.

Thanks for providing suggetions! I am trying to resolve those unresolved sysmbols!

I have temporarly convert Makefile project to Visual Studio 2022 -> C++ Static Library project, and trying to resolve window compatible header file and codding, It's more easy to do work with visual studio build system for windows!

image

@ctoabidmaqbool
Copy link
Author

ctoabidmaqbool commented Sep 20, 2024

@johanvos @jperedadnr Please! Review my PR!

I have temporary add Visual Studio 2022 -> C++ Static Library Project / Solutions. Which I used localy in my PC to get vmone.lib only (without libjdk.lib included) for testing purpose, until final solution I can get out!

I have put both files e.g. vmone.lib and libjdk.lib inside .gluoun to specific folder to do testing e.g.
image

Add linkerArgs for hello-gluon-ci project:

<linkerArgs>
    <arg>libjdk.lib</arg>
    <arg>/LTCG</arg>
    <arg>/FORCE:MULTIPLE</arg>
</linkerArgs>

Add /FORCE:MULTIPLE to exclude second duplicate defination (temporary fix)

libjdk.lib(awt_Toolkit.obj) : error LNK2005: DllMain already defined in libjdk.lib(net_util_md.obj) (error before adding)
libjdk.lib(awt_Toolkit.obj) : warning LNK4006: DllMain already defined in libjdk.lib(net_util_md.obj); second definition ignored (warning after adding)

Add /LTGC as suggestion is given:

vmone.lib(JvmFuncs.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

After testing, my desktop App runs secessfully e.g. mvnw -Pdesktop gluonfx:build gluonfx:nativerun!

image

Note: I have to be able to build on github actions runner (windows container) pending. and libjdk.lib must be added up to vmone.lib (pending)

…ot changed at all;

Add JVM_RaiseSignal(int) function;
Add Visual Studio 2022, C++ Static Library Solutions/Project;
@ctoabidmaqbool
Copy link
Author

I thank, before comment I have done some mistake, I am not sure, now my native app is not running

E.g.

mvn -Pdesktop gluonfx:build (working)
mvn -Pdesktop gluonfx:nativerun (not working) error: Result for run until end: -1073741819

Console logs:

D:\GraalVM-Projects\gluonhq\hello-gluon-ci>mvn -Pdesktop gluonfx:nativerun
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.gluonhq.samples:hellogluon >-------------------
[INFO] Building HelloGluon 1.0.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- gluonfx-maven-plugin:1.0.25-SNAPSHOT:nativerun (default-cli) @ hellogluon ---
Configuration: ProjectConfiguration{graalPath='D:\Programs\graalvm-java23-windows-amd64-gluon-23+25.1-dev', javaStaticSdkVersion='24-4', javafxStaticSdkVersion='24-ea+7.1', javaVersion=23, graalVersion=23, useJNI=true, useJavaFX=true, usePrismSW=true, enableCheckHash=true, targetTriplet=x86_64-microsoft-windows, hostTriplet=x86_64-microsoft-windows, backend='null', bundlesList=[], resourcesList=[], reflectionList=[], jniList=[], initBuildTimeList=[], runtimeArgsList=[], releaseSymbolsList=null, appName='HelloGluon', releaseConfiguration='ReleaseConfiguration{packageType=null, description='The HelloGluon app', vendor='Gluon', version='null', macAppStore=false, macSigningUserName=null, macAppCategory=null, bundleName='null', bundleVersion='null', bundleShortVersion='null', providedSigningIdentity='null', providedProvisioningProfile='null', skipSigning=false, simulatorDevice='null', appLabel='null', versionCode='null', versionName='null', providedKeyStorePath='null', providedKeyStorePassword='null', providedKeyAlias='null', providedKeyAliasPassword='null'}', mainClassName='com.gluonhq.hello.HelloGluonApp', classpath='D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\classes;D:\.my-m2\repository\com\gluonhq\charm-glisten\6.2.3\charm-glisten-6.2.3.jar;C:\Users\MSC-30\.m2\repository\com\gluonhq\attach\display\4.0.21\display-4.0.21-desktop.jar;D:\.my-m2\repository\com\gluonhq\attach\display\4.0.21\display-4.0.21.jar;C:\Users\MSC-30\.m2\repository\com\gluonhq\attach\lifecycle\4.0.21\lifecycle-4.0.21-desktop.jar;D:\.my-m2\repository\com\gluonhq\attach\lifecycle\4.0.21\lifecycle-4.0.21.jar;C:\Users\MSC-30\.m2\repository\com\gluonhq\attach\statusbar\4.0.21\statusbar-4.0.21.jar;D:\.my-m2\repository\com\gluonhq\attach\statusbar\4.0.21\statusbar-4.0.21.jar;C:\Users\MSC-30\.m2\repository\com\gluonhq\attach\storage\4.0.21\storage-4.0.21-desktop.jar;D:\.my-m2\repository\com\gluonhq\attach\storage\4.0.21\storage-4.0.21.jar;D:\.my-m2\repository\com\gluonhq\attach\util\4.0.21\util-4.0.21.jar;D:\.my-m2\repository\org\openjfx\javafx-base\24-ea+5\javafx-base-24-ea+5-win.jar;D:\.my-m2\repository\org\openjfx\javafx-base\24-ea+5\javafx-base-24-ea+5.jar;D:\.my-m2\repository\org\openjfx\javafx-controls\24-ea+5\javafx-controls-24-ea+5-win.jar;D:\.my-m2\repository\org\openjfx\javafx-controls\24-ea+5\javafx-controls-24-ea+5.jar;D:\.my-m2\repository\org\openjfx\javafx-graphics\24-ea+5\javafx-graphics-24-ea+5-win.jar;D:\.my-m2\repository\org\openjfx\javafx-graphics\24-ea+5\javafx-graphics-24-ea+5.jar'}
[Sat Sep 21 21:17:42 PKT 2024][INFO] ==================== RUN TASK ====================
[Sat Sep 21 21:17:42 PKT 2024][FINE] PB Command for run until end: D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\HelloGluon.exe
[Sat Sep 21 21:17:42 PKT 2024][FINE] Start process run until end...
[Sat Sep 21 21:17:43 PKT 2024][FINE] Result for run until end: -1073741819
[Sat Sep 21 21:17:43 PKT 2024][SEVERE] Process run until end failed with result: -1073741819
Check the log files under D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\x86_64-windows\gvm\log
And please check https://docs.gluonhq.com/ for more information.
[Sat Sep 21 21:17:43 PKT 2024][INFO] Logging process [run until end] to file: D:\GraalVM-Projects\gluonhq\hello-gluon-ci\target\gluonfx\log\process-run until end-1726935463885.log
             _______  ___      __   __  _______  __    _
            |       ||   |    |  | |  ||       ||  |  | |
            |    ___||   |    |  | |  ||   _   ||   |_| |
            |   | __ |   |    |  |_|  ||  | |  ||       |
            |   ||  ||   |___ |       ||  |_|  ||  _    |
            |   |_| ||       ||       ||       || | |   |
            |_______||_______||_______||_______||_|  |__|

    Access to the latest docs, tips and tricks and more info on
    how to get support? Register your usage of Gluon Substrate now at

    https://gluonhq.com/activate



[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.090 s
[INFO] Finished at: 2024-09-21T21:17:46+05:00
[INFO] ------------------------------------------------------------------------

@ctoabidmaqbool
Copy link
Author

ctoabidmaqbool commented Sep 24, 2024

It looks like I am just wasting my important time! Unfortunatly no proper response from Gluon team!
It looks like gluon techonolgoy is just a expiremental tool, which somehow works and sometime not, it's not for production ready projects!

If someone is using old plugins no support at all, javafxmobile-plugin.
Now the case of Window in latest gluonfx-maven-plugin
no support at all!

What could be expacted in feature!

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

Successfully merging this pull request may close these issues.

3 participants