Home > OS >  Deploy Qt to Windows on a Linux machine
Deploy Qt to Windows on a Linux machine

Time:10-13

Feels like a silly question, but I'm struggling to find the answer online: Is it possible to deploy Qt apps to Windows if you did development on a Linux machine? It seems the answer should be "yes", but I can't seem to use windeployqt on my linux machine.

If it is possible, what additional resources do I need to do this?

CodePudding user response:

Yes, it's of course possible.

  1. You have to cross-compile Qt using the MinGW compiler, targeting Windows.

  2. You'll have to patch and build windeployqt yourself. By default, windeployqt is looking for g .exe in the path. Of course this makes no sense on a linux build host, so you'd have to tweak it so that it finds the correct compiler and runtime libraries.

  3. You can then build your application using the cross-targeted Qt build, and deploy all the necessary artifacts into some deploy folder using windeployqt.

  4. To package the deployed build, you can run nsis or wix on Linux as well, to obtain a Windows installer. You can even sign the executable files (required these days for Windows), there's an open source tool called osslsigncode - it works on most platforms and doesn't require Windows.

It'll take a bit of time for you to figure it all out. It's certainly easiest to just build on Windows and not mess with it. But if you insist on building on Linux - you certainly can.

  • Related