Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to deploy an QT App from Windows to Linux?



  • I am a Windows user.
    Made a Qt app by Qt Creator.
    windeployqt.exe works fine on windows.

    now I want to create a Linux version of my app.
    But I google the way to deploy on Linux.
    What I can find is the way of "write, compile, run app on Linux, use linuxdeployqt to deploy the app".
    I can't find the way of "made on Windos, and deploy app to Linux"

    I am totally rookie of Linux, is there has a way to make a linux version app made by windows environment?
    Or I have to make a Linux environment, copy source code to compile that?

    thank you for your reading.


  • Lifetime Qt Champion

    @pachisuro4096 The easiest way is to have a Linux machine to build your application for Linux. It can be a real machine or a virtual machine in your Windows.

    Another, more complicated to set up, way is to do cross compilation on Windows but for Linux. In this case you would need to set up a cross compilation environment first.

    I suggest to go with the first option. In stall Linux on a machine and build your app there.



  • @pachisuro4096
    Hello and welcome.

    Executables built on one platform, Windows, cannot be run on another platform, Linux. Qt source code is (should be) compatible for different platform targets, but it has to be re-compiled for the target architecture, and only after that can be deployed there.

    I may be mistaken, but I do not think there is a viable cross-compiler available for Windows to produce Linux code.

    I would suggest the best way is to install a virtual machine (e.g. VirtualBox) on the Windows machine which runs a flavor of Linux. Then you copy your source project into that box and do the Linux compilation there.

    Finally, unlike Windows there are many different Linux distributions, with both different Linux flavors and different hardware architectures. A Qt/C++ application compiled for one flavor/architecture will not work on a different Linux flavor/architecture. So you have to know which Linuxes you want to target, and likely compile for each one (possibly cross-compilable from a gcc compiler on one architecture).



  • I got it!! Thanks both of you !!
    Now I'm going to study how to build a Linux and QT.



  • @pachisuro4096
    For example, I fetched VirtualBox (you can Google, it's easy to find) and put on my Windows (7) host. Then I downloaded the latest Ubuntu "image" from the web, and followed instructions to install that into the VB as guest OS. Now you have a running Linux any time you want as a virtual machine on your Windows box. You can boot into it, run Linux, do your development there (in a window, you can still use Windows for everything else). It's quite fun :)

    There are other choices than these, but this is (an example of) what having a Linux VM on a Windows box is like.


Log in to reply