Important: Please read the Qt Code of Conduct -

Building from a single PC for all platforms

  • New to Qt.

    I am required to take over a project which has QT source. The project gets built for Windows, MacOS, Android and iOS. Is there a way to build all these platform versions from the same Windows or Ubuntu computer? Are Docker or similar images available that have the basic set up already present to allow me to do this?

    I must admit I do not really understand the terminology nor practicalities around Build Kits in Qt. When I've tried it has always tended to be a trial and error process to get it to build for my PC environment, after which I dare not touch it. I can code OK, and have built build system from the ground up using C, make etc for decades so I do have a basic understanding but I find I quickly get lost when trying to get my head around cross platform building in Qt.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    If you want only one machine for all the platforms, then use a Mac with virtual machines for Windows and Linux.

    That way you can not only build with the adequate compiler but also properly test your code on all the platforms.

  • Hi,
    I agree with @SGaist - this is exactly my workflow: mac natively and VMs for other two.

    As for virtualisation on Mac I would NOT recommend Virtualbox - the way it works on mac is very inferior. I was forced to buy Parallel's Desktop, where both Debian (Ubuntu ain't that much different, I believe it will work as Debian) and Windows 10 work nicely in terms of development. Additional bonus that PD has ability to get rid of the guest system's desktop and to offer applications working like you'd run them natively.

  • @SGaist Thank you.

    Could I trouble you for a outline list of what software I would need to install in the VMs for Windows and for Android builds with Qt 5.12? This is the bit that is confusing me the most.

  • @TenG No problem. It has been equally confusing once I moved from Windows+Linux dev setup to include macOS.

    I had no problems running VritualBox on Windows with Debian guest however, as I mentioned above, Vbox on macOS is infernal. So I had to explore other options.
    I found optimal that my main computer should run macOS (please note, you'd need a fair amount of RAM and hard disk, I'll sum this up later on), with virtualised Windows and Debian guest. Since Qt is beautifully portable and you only need platform specific code for system notifications and other bits and pieces like that (that can be achieved, and that's how I do it, using #ifdef Q_OS_XXXX clauses). Please also note that I don't write about mobile platforms like Android as I don't develop for it.

    For virtualisation I found Parallels Desktop working just fine: This is commercial software and it is not the cheapest thing around but for me it's worth every penny. You can install Debian/Ubuntu without much of a fuss, same comes for Windows (it even downloads the installer). However, you'd need Windows licence. How you get that depends on your working arrangements, of course. There are websites that offer significant discounts on Windows licences but please consult your Legal advisor, should your company have one, before you buy any discounted licence. Let's stay safe.

    Now, setup. My first host was macbook pro running i5 intel 3GHz with 16GB of RAM. It was sufficient to work with Windows in coherence mode. Since then I pimped my hardware a bit but the above was working just fine.
    Windows VM: with Parallels, 70GB of dynamic hard drive and 6GB of RAM, giving it dedicated 2-4 cores. Enough for Qt working seamlessly. I extended that later to solid 4 cores and 8GB of RAM, it will work even on 4GB and 2 cores though. Please note the hard drive space - you could go with less but then updates (especially the big ones done twice a year) might have trouble installing.
    Debian VM: I can't say for sure how it will work with Ubuntu, with Debian running KDE actual memory usage after boot is 500MB. Running Qt I never had more than 1.8GB consumed. 2-4 cores is optimum. As for hard disk space, please consult Ubuntu manuals as it really depends on how you treat updates, how many and which packages you have and how you partition your disks.

    And that's mostly it. I mapped working folders from host to guest OSes in order to avoid playing with Git all the time but that can be tricky if you decide to edit in host and guest at the same time - having git handling the versioning might be safer.
    My workflow is that I mostly and mainly develop on host macOS, unless it's something platform specific, then when needed run VM, compile, test.

    Last thing - Android: you can install NDK and other stuff on macOS in similar way you do it on Windows. Qt packages for Android can also be installed on mac. So no need to VM it or something.

    Hope this helps.

  • This post is deleted!

Log in to reply