Qt World Summit: Submit your Presentation

Build QT5.15.2 module from split source

  • Hi everyone,
    I am interested in building only specific modules from the "split source" packages available from here: http://download.qt.io/official_releases/qt/5.15/5.15.2/submodules/ . More specifically, I am interested in building qtbase and qtsvg. For the record, I am building on Windows using Visual Studio 2019 and jom.

    I am successful in building the qtbase module, out of source, using the split source package. For doing so, I unpack the qtbase package in qt-5.15.2/src/qtbase . Then I create an out-of-source build directory ( qt-5.15.2/build ), and I call configure / jom / jom install from there.

    (in qt-5.15.2 dir)
    mkdir build
    cd build
    ..\src\qtbase\configure.bat -confirm-license -opensource -opengl desktop -mp -nomake tests -nomake examples -prefix ..\inst
    jom install

    According to this thread ( https://stackoverflow.com/questions/55276709/how-to-build-a-selection-of-qt5-submodules-from-source ), I should be able to build qtsvg "in addition to" qtbase. More specifically, that thread suggest to do the following:

    (in qt-5.15.2/build dir)
    mkdir qtsvg
    cd qtsvg
    ..\..\inst\bin\qmake.exe ..\..\src\qtsvg

    However when doing so, the build quickly fails with the following error message:

    [path]/src/qtsvg/.qmake.conf:1: Cannot find feature qt_build_config
    Could not find qmake spec 'win32-msvc'.
    Error processing project file: ..\..\src\qtsvg\qtsvg.pro

    So, can anyone help me understand how to build specific modules from the "split source" packages available from the above link? In particular, how can I build qtsvg in addition to qtbase with the same configuration options.

    Thank you very much.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I do not affirm it's the source of your issue but I would use a full path for the prefix parameter.

  • Thank you for your help, unfortunately it produces the exact same error message. Actually, the compilation/installation of qtbase works, it is only the qtsvg part that does not.

  • Lifetime Qt Champion

    Can you test an other module like qtserialport ?

  • Thanks again for your help. Unfortunately, it results in similar message. I execute the following:

    (in qt-5.15.2/build dir)
    mkdir qtserialport
    cd qtserialport
    ..\..\inst\bin\qmake.exe ..\..\src\qtserialport

    and obtain the following messages:

    [path]/src/qtserialport/.qmake.conf:1: Cannot find feature qt_build_config
    Could not find qmake spec 'win32-msvc'.
    Error processing project file: ..\..\src\qtserialport\qtserialport.pro

    I feel I am missing a step or something. I feel that similarly to qtbase, I would need to "configure" the qtsvg build, or at the very least to make it "know" about the qtbase configuration. However, by directly invoking qmake with a project path, I feel like qmake is not taking my configure options into account.

    Thanks again for your help!

  • Lifetime Qt Champion

    That's strange.

    Note that I am used to build only parts of Qt but from the full sources. If that would be an option, you should test that.

  • I would prefer not having to download and unpack the whole source if possible. I would assume that if the split source packages are distributed it would be possible to build related libs from them, but I may be the only one trying to do that, since I wasn't able to find the build instruction for those...?

    Anyway, as a plan B, that could be an option to only build required modules from the whole source (qt-everywhere-src-5.15.2.zip I assume?). Could you point me to or explain how to do this only for qtbase and qtsvg?


  • Lifetime Qt Champion

    Exactly the same as you did with the split sources.

    What I usually do is have a build dir that follows the same layout as Qt's sources.

    Then you build qtbase as you just did followed by qtsvg.

  • Hi again,

    So I think it was a "dirty build dir" problem... I restarted by unpacking the source again and retried the procedure from the start, and it worked. Thank you very much for your help, really appreciated!

    Now for the record, in case someone else try to do the same build as I did, here are the steps to build modules from the "split source" packages.

    1. Unpack each split source package in its own directory (e.g. tmp\src\qtbase, tmp\src\qtsvg, etc.)
    2. Create an out-of-source build directory (e.g. tmp\build)
    3. Go to that build directory and run configure with your preferred options (e.g. ..\src\qtbase\configure.bat [options])
    4. Build qtbase (e.g. jom)
    5. Install qtbase (e.g. jom install)
    6. Now for each additional module, create a subdirectory for that module under the build directory (e.g. tmp\build\qtsvg)
    7. Go to that subdirectory and call qmake on your submodule (e.g. ..\..\prefix\bin\qmake.exe ..\..\src\qtsvg)
    8. Build the submodule (e.g. jom)
    9. Install the submodule (e.g. jom install)

    Thanks again for your help and have a great day!

  • Lifetime Qt Champion

    Thanks for the feedback !

    Happy coding :-)

Log in to reply