-
Notifications
You must be signed in to change notification settings - Fork 65
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
[Feature] WSL2 support. #486
Comments
I don't really understand the context. Afaik WineHQ is only available on linux & macs to provide a POSIX compatibility layer to windows kernel calls. It wouldn't be used if you're already on windows. And I'm unaware of any apache cordova package that attempts to use wine (or WSL). Are you able to elaborate? |
@breautek Sure. Windows Sub-System for Linux (WSL) is basically a Linux emulation layer. I use it to run Ubuntu mostly. You can of course run Linux programs within it, but you can also run Windows executables from it. I have a project that's in my home folder in WSL (Ubuntu), and I connect to it using vscode remote to WSL. I can build Linux version of app, but it would be nice that instead of using wine32, it would detect WSL and just run the .exe (like code sign etc) directly. Edit: I was also successful in installing wine32 in WSL and being able to build .exe, and while the final .exe would run, it would crash after showing the window. |
I think I understand now. Mixing environments is going to be a recipe for disaster. It's not something I'd recommend. But like I said, Cordova doesn't choose to run under wine. I've done an apache-cordova wide search for wine (or WSL/WSL2) and couldn't find anything. Cordova itself should operate under WSL, but you should install all the linux version of the tools, including a linux node, and the platform sdk for linux (e.g. android sdk tools for linux). Platforms usually have generated environment-specific files, so having a platform installed in a linux environment (like WSL) and then attempting to use the windows-version of the platform SDK on that project probably will not work. For example, android projects generated in a linux environment will use linux/posix file paths and windows version of the SDK will fail. Likewise an android project generated on a windows environment will have windows paths and will fail in a linux environment. If you launch windows executables from WSL, it will launch the "windows" application and will trip OS environment checks, so it's important to install the linux version of the SDKs, like using a linux nodejs build to run Cordova. I'm using the android platform for examples because it's what I'm the most familiar with but other platforms will likely have similar situations. If a project has multiple build targets (like electron) then you might need to clean the platform when switching environments. There is limited support for cross-compiling electron apps. Am I misunderstanding something? |
@breautek I remember back in the day I did cross compiling with Free Pascal. Was making a cross platform game engine, and set it up to build on whichever platform right from one OS (windows, Linux, android). So it's not as if we should be sticking with the can't be done and not great mindset, as we should be aiming for a future where we can cross build all our apps from one OS, especially since I've been able to do that with Free Pascal for many years. I know people can just say, setup a Docker and run Windows / Linux. But then of course there's the greedy Apple nightmare of being the only OS where you're pretty much forced to build it's stuff on it's own OS. Then there's the pre-built exe age (like unity does with players). Pre-build the executable and just have separate files as your content. Which in reality, as far as I know, electron does this approach? In the end, if code signing exe is the only thing electron builder needs to run in windows mode, there are other tools (just some Google searches) that you can use in Linux to sign the exe? |
It's not usually in the control of Cordova. It's often due to the underlying SDKs and/or licensing issues. Like you said, anything Apple is pretty much only supported on Mac OS.
For code-signing windows apps on mac/linux it is possible and electron itself has a guide to do so making use of a GPL-3 licensed tool. They are always license concerns surrounding around GPL packages. Apache isn't allowed to redistribute any GPL code or tools. So code-signing on linux is definitely not something that can be supported out of the box. The electron guide also notes using jsign instead which is an Apache 2.0 licensed product, so that could be a solution for codesigning window applications from mac and/or linux. In which case, I'd suggest creating a more specific feature request in cordova-electron. I'm not familiar with the electron platform myself, so I'm not sure if the solutions are even accessible from within Cordova project.
I believe so for the electron core itself. This is mostly because compiling electron involves compiling chromium which is a beast of a project. If the electron project depends on any node modules that uses native C++ addon API, unless if they also supply prebuilt binaries, cross-compiling won't be supported. Most node modules that does include native addons do not supply prebuilt binaries because it's significantly easier to distribute the source and have the workstation compile for their own environment against the specific nodejs engine, etc. |
That's interesting. A license for open source holding back innovation. That's awfully unfortunate. The electron builder tool downloads needed binaries / packages, it could be aimed at getting the other signing tools? I suppose this feature request should be on electron builder? |
Feature Request
Instead of using Wine, and you're on windows doing multiplatform build, why not detect and use WSL2 instead of running wine?
Motivation Behind Feature
Wine32 doesn't seem to install on WSL2.
Alternatives or Workarounds
Attempting to install Wine32.
The text was updated successfully, but these errors were encountered: