Qt World Summit: Submit your Presentation

How to build efficiently different qt versions from sources?

  • Let's say you've cloned https://github.com/qt/qtbase, configured succesfully using some prefix path and built.

    My concern comes from the fact that configure.bat instructions says

    Prior to reconfiguration, make sure you remove any leftovers from
    the previous build.

    So I guess one way to remove these "leftovers" from previous build would be doing something drastically like git checkout -- . && git clean -fxd, then just switch the branch/version and configure/build again... problem if you did so is you'd end up spawning a cold build again, which is really unoptimal.

    So, what's the recommended way to rebuild different qt versions from sources so just the first build will take hours?

    For instance, how would you build 5.12.1, 5.12.2, 5.12.3, 5.12.4 effectively in that order?

    Or the more typical common case, what's the recommended way to build the latest master version (5.12 right now) and rebuild with incoming changes from upstream?


  • I think, if installation paths of different Qt versions would be different, there won't be a problem. That should be a warning for the case that you install multiple Qt builds in the same path. You can specify the installation directories as you want. Just simple as setting the -prefix variable as the path you want to install Qt to.
    ./configure -prefix /opt/qtsomething //and your other settings

  • Sure, I'm definitely using prefix each time I switch/try a new commit... that said, it seems If I don't clean (git checkout -- . && git clean -fxd) before configuring after I've switched the branch configure.bat will give me errors :'( . Not cool as I don't know any reliable tool for caching stuff with visual studio (similar to ccache) and making cold builds each time I wanna try a new commit is nuts

  • Lifetime Qt Champion


    The first thing to do: stop building in the sources. Use out of source builds, this will allow you to keep the source clean and if the build goes wrong, you can just nuke the build folder and start over.

Log in to reply