webview_rust icon indicating copy to clipboard operation
webview_rust copied to clipboard

[Feature/Docs] Ability to Cross Compile From Linux to Windows & Mac

Open zicklag opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. I prefer to build applications in Linux Docker containers for maximum automation, reproducibility, and build portability. That said, I still need to be able to build applications for Windows and Mac and I have since done that by cross compiling the application using MingW for windows and OSX Cross for Mac. Without being able to cross compile from Linux, you have to use a CI service that provides all three operating systems. While these exist, and they are free for Open Source projects, I prefer to be able to host these builds myself when necessary and the most cost effective and simple way to do that is by cross compiling from Linux.

Describe the solution you'd like I would like to work out the required build steps and tools necessary to cross-compile for Windows and Mac from Linux.

Describe alternatives you've considered Going with GitHub Actions for automated builds is definitely a decent option, but again, I prefer to be able to produce these same builds on my local machine and using Linux Docker containers is the most productive way to do that.

Additional context If we get this working I am going to be building my Tauri application with Drone and could easily derive a template build that could be used for other's Tauri applications, allowing people to build for all three platforms using only Linux servers on either the public Drone cloud, or their own build farm.

zicklag avatar Aug 01 '20 23:08 zicklag

This is going to be to complicated process I think. Especially it's a nightmare to be able to run on windows image because of dll paths.

wusyong avatar Aug 06 '20 11:08 wusyong

I still haven't succeeded in it yet, but I think it may not be impossible to get working using mingw and a pre-built webview.dll which is going to be built automatically on a windows machine in Webview's CI ( https://github.com/webview/webview/issues/440 ).

I haven't had time to test it out yet, but we should be able to compile with MingW and link against that webview.dll and include the webview.h to compile against it.

Some reference: https://github.com/webview/webview/issues/311.

zicklag avatar Aug 06 '20 19:08 zicklag

Well, maybe it won't work. I don't know why, but when I compile a simple C program just like is mentioned here and I link against the pre-built DLL, the generated executable will not run ( in my windows dev VM ). I gets to showing the window, which actually does get the titlebar title set correctly, but the window just goes into "Not responding" mode with a white screen as soon as it pops up. :confused:

I tried compiling with Clang and MingW. I'm not sure if it has something to do with trying to link a gnu abi executable to an msvc abi library? I've never done that before I don't think. I don't know.

I guess I might just have to do the compilation on windows with GitHub actions.

zicklag avatar Aug 07 '20 22:08 zicklag