简体   繁体   English

在Linux机器上部署Qt到Windows

[英]Deploy Qt to Windows on a Linux machine

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?感觉像是一个愚蠢的问题,但我正在努力在网上找到答案: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.似乎答案应该是“是”,但我似乎无法在我的 linux 机器上使用 windeployqt。

If it is possible, what additional resources do I need to do this?如果可能,我需要哪些额外资源才能做到这一点?

Yes, it's of course possible.是的,这当然是可能的。

  1. You have to cross-compile Qt using the MinGW compiler, targeting Windows.您必须使用 MinGW 编译器交叉编译 Qt,目标为 Windows。

  2. You'll have to patch and build windeployqt yourself.您必须自己修补和构建 windeployqt。 By default, windeployqt is looking for g++.exe in the path.默认情况下,windeployqt 在路径中查找g++.exe 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.当然,这在 linux 构建主机上没有任何意义,因此您必须对其进行调整,以便它找到正确的编译器和运行时库。

  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.然后,您可以使用交叉目标 Qt 构建构建您的应用程序,并使用 windeployqt 将所有必要的工件部署到某个deploy文件夹中。

  4. To package the deployed build, you can run nsis or wix on Linux as well, to obtain a Windows installer.对于 package 部署的构建,您也可以在 Linux 上运行nsiswix ,以获得 Windows 安装程序。 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.您甚至可以签署可执行文件(目前 Windows 需要),有一个名为osslsigncode的开源工具 - 它适用于大多数平台,不需要 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.只在 Windows 上构建而不是弄乱它当然是最简单的。 But if you insist on building on Linux - you certainly can.但如果你坚持在 Linux 上构建 - 你当然可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM