Building Qt6 from source on Linux: qsb not found but it's there
-
Hello,
I'm trying to build Qt6 for Android on Linux, but I'm having a few issues I'm not sure how to solve.
In brief: I have a working host Qt6 installation from my distribution, I have a local Qt6 repo with matching checked-out version (v6.3.1), I have the required android tools downloaded and installed, qtcreator has green check marks all around it. Now, I just have to build Qt6 for Android. Here be dragons.My distribution packages Qt6 modules separately, so
Qt6Baseis in/opt/foo/qtbase,Qt6ShaderToolsis in/opt/bar/qtshadertoolsand so on.The problem is that cmake cannot find Qt6ShaderTools, and in particular the
qsbtool; but it is installed, in path and discoverable via pkg-config:$ which qsb /usr/bin/qsb $ qsb Usage: qsb [options] file Qt Shader Baker (using QShader from Qt 6.3.1) <cut> $ pkg-config --list-all | grep Shader Qt6ShaderTools Qt6 ShaderTools - Qt ShaderTools moduleSo, when I try to configure Qt6, I'm getting errors related to missing
qsb, I tried using:$ ../qt6/configure -qt-host-path /opt/foo/qtbase \ -platform android-clang -prefix $PWD/../qt6-install \ -android-sdk ../android-sdk/ \ -android-ndk ../android-sdk/ndk/21.3.6528147/ <cut> Configuring submodule 'qtbase' -- Could NOT find double-conversion (missing: double-conversion_DIR) -- Could NOT find md4c (missing: md4c_DIR) -- Could NOT find double-conversion (missing: double-conversion_DIR) -- Could NOT find md4c (missing: md4c_DIR) Configuring submodule 'qtimageformats' Configuring submodule 'qtlanguageserver' Configuring submodule 'qtshadertools' -- Could NOT find Qt6ShaderToolsTools (missing: Qt6ShaderToolsTools_DIR) CMake Error at qtbase/cmake/QtToolHelpers.cmake:170 (message): The tool "Qt6::qsb" was not found in the Qt6ShaderToolsTools package. Package found: 0 Call Stack (most recent call first): qtshadertools/tools/qsb/CMakeLists.txt:8 (qt_internal_add_tool)This is Ok: since Qt6ShaderTools is installed in a different directory, I could expect that - for some reason - cmake couldn't find it using
pkg-configalone (I also tried using the-pkg-configflag to force it). So I specified$ ../qt6/configure <cut> -- -DQt6ShaderToolsTools_DIR=/opt/bar/qtshadertoolsin the configure script, so that the flag should be passed to CMake, and indeed it is. This is the cmake command that is invoked when I specify that flag (made readable)
'/opt/baz/cmake' '-DQT_HOST_PATH=/opt/foo/qtbase/' '-Dmd4c_DIR=/opt/qux/md4c/' '-DQt6ShaderToolsTools_DIR=/opt/bar/qtshadertools/' '-DCMAKE_INSTALL_PREFIX=/home/my_project/qt6-android-build/../qt6-android-install' '-DQT_QMAKE_TARGET_MKSPEC=android-clang' '-DANDROID_SDK_ROOT=../android-sdk' '-DANDROID_NDK_ROOT=../android-sdk/ndk/21.3.6528147' '-G' 'Ninja' '/home/my_project/qt6'still, I get the same errors seen above
Configuring submodule 'qtbase' -- Could NOT find double-conversion (missing: double-conversion_DIR) -- Could NOT find md4c (missing: md4c_DIR) -- Could NOT find double-conversion (missing: double-conversion_DIR) -- Could NOT find md4c (missing: md4c_DIR) Configuring submodule 'qtimageformats' Configuring submodule 'qtlanguageserver' Configuring submodule 'qtshadertools' -- Could NOT find Qt6ShaderToolsTools (missing: Qt6ShaderToolsTools_DIR) CMake Error at qtbase/cmake/QtToolHelpers.cmake:170 (message): The tool "Qt6::qsb" was not found in the Qt6ShaderToolsTools package. Package found: 0 Call Stack (most recent call first): qtshadertools/tools/qsb/CMakeLists.txt:8 (qt_internal_add_tool)Please note that
-DQt6ShaderToolsTools_DIRis set, but when configuringqtshadertoolsit is reported as missing. Interestingly, this holds true qhen configuringqtbasewithmd4c_DIRwhich is installed and it is set in a similar way.double-conversionis also present, but not found bypkg-config.I'm no cmake expert, but I used
-Dblahblah_DIRin past and I expected it to work... The feeling is that such options are kind of ignored when they are passed to qtbase and qtshadertools submodules.Am I doing something wrong or is the cmake configuration at fault?
Thank you!