Skip to content

Instantly share code, notes, and snippets.

@cajus
Last active May 26, 2024 05:56
Show Gist options
  • Save cajus/689eca85be257997019065979799e2f6 to your computer and use it in GitHub Desktop.
Save cajus/689eca85be257997019065979799e2f6 to your computer and use it in GitHub Desktop.
Building Qt for WebAssembly
# Get dependencies in place (example for Debian based systems)
sudo apt-get build-dep --yes qt5-default
sudo apt-get install --yes libxcb-xinerama0-dev git python cmake default-jre
# Install Emscripten
git clone https://github.com/juj/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
source emsdk_env.sh
cd ..
# Build Qt
git clone -b 5.12.0 https://code.qt.io/qt/qt5.git
cd qt5
./init-repository -f --module-subset=qtbase,qtdeclarative,qtwebsockets,qtsvg,qtquickcontrols,qtquickcontrols2,qtgraphicaleffects
./configure -opensource -confirm-license -xplatform wasm-emscripten -release -static -no-feature-thread -nomake examples -no-dbus -no-ssl
make
cd ..
# Build your project
git clone https://github.com/msorvig/qt-webassembly-examples.git
cd qt-webassembly-examples/quick_controls2_gallery
../../../qt5/qtbase/bin/qmake
make
# Serve it and browse to http://localhost:8000/gallery.html
python -mSimpleHTTPServer
@izzaNaqvi2
Copy link

I have done all this successfully, I can not run some of the projects, for example, QT_CONTROLS2_GALLERY, it says qt quick controls 2 not installed , but they are installed already.
Plus i have a Visual Studio Project that uses QT library, i wantto run that on web assembly but i am getting error ca, someone plza guide.

@divyanshusahu
Copy link

'x86intrin.h' file not found

I solved this error by switching to qt-5.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment