I am experimenting with Qt for WebAssembly and wrote a small application. When I build and run it from the console or directly inside Qt Creator, everything works fine.
Now I’d like to use CLion as my main IDE, but I’m struggling to get the CMake configuration right. No matter what I try, I can’t get the project to configure successfully.
Here’s what I’ve done so far:
I included the environment file in the Toolchain and set the C/C++ compilers there.
export EMSDK=/home/emmynoether/emsdk
export EM_CONFIG=/home/emmynoether/emsdk/.emscripten
export QMAKESPEC=wasm-emscripten
export QT_WEBASSEMBLY_ROOT_PATH=/home/emmynoether/Qt/6.8.3/wasm_singlethread
export PATH="/home/emmynoether/emsdk/upstream/emscripten:/home/emmynoether/emsdk/node/22.16.0_64bit/bin:$PATH"
I gave the CMake Options for Host and Target Qt:
-DQt6_DIR=/home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6
-DQT_HOST_PATH=/home/emmynoether/Qt/6.8.3/gcc_64
Now i get the error
/home/emmynoether/Downloads/clion-2025.1.3/bin/cmake/linux/x64/bin/cmake -DCMAKE_MAKE_PROGRAM=ninja -DCMAKE_C_COMPILER=/home/emmynoether/emsdk/upstream/emscripten/emcc -DCMAKE_CXX_COMPILER=/home/emmynoether/emsdk/upstream/emscripten/em++ -DQt6_DIR=/home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6 -DQT_HOST_PATH=/home/emmynoether/Qt/6.8.3/gcc_64 -G Ninja -S /home/emmynoether/Dokumente/Webseite/MaterialStack -B /home/emmynoether/Dokumente/Webseite/MaterialStack/cmake-build-default-qt-webassembly
-- The CXX compiler identification is Clang 19.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /home/emmynoether/emsdk/upstream/emscripten/em++
-- Check for working CXX compiler: /home/emmynoether/emsdk/upstream/emscripten/em++ - works
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_CXX_COMPILER = /home/emmynoether/emsdk/upstream/emscripten/em++
-- ENV EMSDK = /home/emmynoether/emsdk
-- ENV EM_CONFIG = /home/emmynoether/emsdk/.emscripten
-- PATH = /home/emmynoether/emsdk/upstream/emscripten:/home/emmynoether/emsdk/node/22.16.0_64bit/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/emmynoether/.dotnet/tools:/home/emmynoether/Downloads/clion-2025.1.3/bin/ninja/linux/x64
-- Qt6_DIR = /home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6
-- HOME = /home/emmynoether
CMake Warning at /home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6/QtFindWrapHelper.cmake:69 (find_package):
By not providing "FindQt6BundledZLIB.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"Qt6BundledZLIB", but CMake did not find one.
Could not find a package configuration file provided by "Qt6BundledZLIB"
with any of the following names:
Qt6BundledZLIBConfig.cmake
qt6bundledzlib-config.cmake
Add the installation prefix of "Qt6BundledZLIB" to CMAKE_PREFIX_PATH or set
"Qt6BundledZLIB_DIR" to a directory containing one of the above files. If
"Qt6BundledZLIB" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
/home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6/FindWrapZLIB.cmake:6 (qt_find_package_system_or_bundled)
/home/emmynoether/Downloads/clion-2025.1.3/bin/cmake/linux/x64/share/cmake-3.31/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
/home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:36 (find_dependency)
/home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6Core/Qt6CoreDependencies.cmake:38 (_qt_internal_find_third_party_dependencies)
/home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6Core/Qt6CoreConfig.cmake:45 (include)
/home/emmynoether/Qt/6.8.3/wasm_singlethread/lib/cmake/Qt6/Qt6Config.cmake:196 (find_package)
CMakeLists.txt:16 (find_package)
I was running the nearly same project on my old Ubuntu machine without so much hassle. I can’t recall it being this utterly complicated.
EDIT------SOLUTION:
I had to built Qt from source with the configuration -qt-zlib:
source /home/emmynoether/emsdk/emsdk_env.sh
mkdir -p $HOME/qt-build && cd $HOME/qt-build
export QT_HOST_PATH=$HOME/Qt/6.8.3/gcc_64
git clone --depth 1 --branch v6.8.3 https://code.qt.io/qt/qt5.git qt6-src
cd qt6-src
# I catched all submodules
git submodule sync
git submodule update --init --recursive
./configure \
-xplatform wasm-emscripten \
-prefix $HOME/Qt/6.8.3/wasm_singlethread \
-opensource -confirm-license \
-nomake tests -nomake examples \
-skip qtwebengine \
-qt-zlib \
-release \
-opengl es2
cmake --build . --parallel $(nproc)
cmake --install .
After that it also worked with Clion.
message(STATUS "QtCreator sees QT_WEBASSEMBLY_ROOT_PATH = $ENV{QT_WEBASSEMBLY_ROOT_PATH}")it is actually empty