Qt Webassembly via conan package manager - "Could NOT find Qt6Quick"
-
Hello,
I am following this guide :
https://www.qt.io/blog/installing-qt-via-conan-package-manager
specifically this gif : https://www.qt.io/hs-fs/hubfs/conan_demo_app_build.gif?width=1600&name=conan_demo_app_build.gif .I am trying to figure out how this process could be used to cross-compile for Qt Webassembly from macOS x86_64.
Here is the project that I have so far : https://wetransfer.com/downloads/859e405c7241c6fd9353944a9e591ddf20220201114259/cffcaf1de2ba8e3cd57fcfc1c9ff83af20220201114312/e85342 .
The ./buildWasm.sh is supposed to build the project, but it fails with this error :
"
-- Could NOT find Qt6Quick (missing: Qt6Quick_DIR)
CMake Error at CMakeLists.txt:15 (find_package):
Found package configuration file:/Users/myUser/.conan/data/qtbase/6.2.2/qt/everywhere/package/5f6084cf36d2dec9c03d119ccdb11027ce3fa5ba/lib/cmake/Qt6/Qt6Config.cmake
but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
FOUND. Reason given by package:Failed to find Qt component "Quick".
Expected Config file at
"/Users/myUser/.conan/data/qtbase/6.2.2/qt/everywhere/package/5f6084cf36d2dec9c03d119ccdb11027ce3fa5ba/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake"
does NOT exist
"...and indeed : QtQuick is in qtdeclarative, and not in qtbase.
How could I fix this issue?
-
A bit of an update :
I just tried this widget application : Qt/Examples/Qt-6.2.1/widgets/richtext/syntaxhighlighter/ .It works well, using the
conanfile.txt
and thebuildWasm.sh
that I have in the zip.
I am copying the contents of those files here :
conanfile.txt
:[requires] qtbase/6.2.2@qt/everywhere qtdeclarative/6.2.2@qt/everywhere
buildWasm.sh
:set -e conan install qtbuildprofiles/6.2.2@qt/everywhere -r qt mkdir -p wasmBuildMachine cd wasmBuildMachine conan install -u ../conanfile.txt --profile=../macos-universal-clang --build=never --update --generator=virtualenv -r qt source activate.sh QT_HOST_PATH=$(echo "$Qt6_DIR" | sed "s#/lib/cmake/Qt6##g") echo "QT_HOST_PATH : $QT_HOST_PATH" source deactivate.sh cd .. conan install -u conanfile.txt --profile=macos-webassembly-x86_64-clang --build=never --update --generator=virtualenv -r qt source activate.sh QT_CMAKE=$(echo "$Qt6_DIR" | sed "s#/lib/cmake/Qt6##g") QT_CMAKE+="/bin/qt-cmake" echo "QT_CMAKE : $QT_CMAKE" mkdir -p buildWasm cd buildWasm echo "$QT_CMAKE ../ -G Ninja -DCMAKE_BUILD_TYPE=Release -DQT_HOST_PATH=$QT_HOST_PATH" $QT_CMAKE ../ -G Ninja -DCMAKE_BUILD_TYPE=Release -DQT_HOST_PATH=$QT_HOST_PATH VERBOSE=1 cmake --build . --config Release --clean-first
Here is a screenshot as well, about this Example application, that I compiled for WebAssembly, running in Chrome :
So it seems like that the issue is with the QtQuick module...
Possible solution ideas are very well welcomed!
I tried many things, but nothing worked so far. -
A quick update : this https://bugreports.qt.io/browse/QTBUG-94524 (Introduce a QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH variable) will solve the issue above.