Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Build simple QML on WebAssembly



  • Hello everyone,

    I'm trying to build my first app on WebAssembly.
    My setup:

    • Windows 10
    • Qt 5.15
    • emsdk install/activate sdk-fastcomp-1.39.7-64bit
    • corrected .emscripten config file in home directory, so Qt Creator could find emscripten

    But I stuck with the same build/compile error:

    14:40:44: Running steps for project untitled1...
    14:40:44: Starting: "D:\Projects\Qt\_SDK\emsdk\emsdk_env.bat" 
    Adding directories to PATH:
    PATH += D:\Projects\Qt\_SDK\emsdk
    PATH += D:\Projects\Qt\_SDK\emsdk\fastcomp\emscripten
    PATH += D:\Projects\Qt\_SDK\emsdk\node\12.18.1_64bit\bin
    PATH += D:\Projects\Qt\_SDK\emsdk\python\3.7.4-pywin32_64bit
    PATH += D:\Projects\Qt\_SDK\emsdk\java\8.152_64bit\bin
    
    Setting environment variables:
    EMSDK = D:/Projects/Qt/_SDK/emsdk
    EM_CONFIG = D:\Projects\Qt\_SDK\emsdk\.emscripten
    EM_CACHE = D:/Projects/Qt/_SDK/emsdk/fastcomp/emscripten\cache
    EMSDK_NODE = D:\Projects\Qt\_SDK\emsdk\node\12.18.1_64bit\bin\node.exe
    EMSDK_PYTHON = D:\Projects\Qt\_SDK\emsdk\python\3.7.4-pywin32_64bit\python.exe
    JAVA_HOME = D:\Projects\Qt\_SDK\emsdk\java\8.152_64bit
    14:40:45: The process "D:\Projects\Qt\_SDK\emsdk\emsdk_env.bat" exited normally.
    14:40:45: Configuration unchanged, skipping qmake step.
    14:40:45: Starting: "D:\Qt\Tools\mingw810_64\bin\mingw32-make.exe" -j8
    D:\Qt\5.15.0\wasm_32\bin\qmake.exe -install sed -e s/@APPNAME@/untitled1/g D:/Qt/5.15.0/wasm_32/plugins/platforms/wasm_shell.html > D:/Projects/Qt/_Builds/build-untitled1-Qt_5_15_0_WebAssembly-Debug/untitled1.html
    copy /y D:\Qt\5.15.0\wasm_32\plugins\platforms\qtloader.js D:\Projects\Qt\_Builds\build-untitled1-Qt_5_15_0_WebAssembly-Debug
    copy /y D:\Qt\5.15.0\wasm_32\plugins\platforms\qtlogo.svg D:\Projects\Qt\_Builds\build-untitled1-Qt_5_15_0_WebAssembly-Debug
            1 file(s) copied.
            1 file(s) copied.
    em++ -s WASM=1 -s FULL_ES2=1 -s FULL_ES3=1 -s USE_WEBGL2=1 -s EXIT_RUNTIME=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --bind -s FETCH=1 -g -s WASM=1 -s FULL_ES2=1 -s FULL_ES3=1 -s USE_WEBGL2=1 -s EXIT_RUNTIME=1 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s EXTRA_EXPORTED_RUNTIME_METHODS=["UTF16ToString","stringToUTF16"] --bind -s FETCH=1 -s ASSERTIONS=2 -s DEMANGLE_SUPPORT=1 -s GL_DEBUG=1 -s ALLOW_MEMORY_GROWTH=1 --source-map-base http://localhost:8000/ -o .\untitled1.js main.obj untitled1.js_plugin_import.obj untitled1.js_qml_plugin_import.obj qrc_qml.obj   D:/Qt/5.15.0/wasm_32/plugins/platforms/libqwasm.a D:/Qt/5.15.0/wasm_32/lib/libQt5EventDispatcherSupport.a D:/Qt/5.15.0/wasm_32/lib/libQt5FontDatabaseSupport.a D:/Qt/5.15.0/wasm_32/lib/libqtfreetype.a D:/Qt/5.15.0/wasm_32/lib/libQt5EglSupport.a D:/Qt/5.15.0/wasm_32/plugins/imageformats/libqgif.a D:/Qt/5.15.0/wasm_32/plugins/imageformats/libqicns.a D:/Qt/5.15.0/wasm_32/plugins/imageformats/libqico.a D:/Qt/5.15.0/wasm_32/plugins/imageformats/libqjpeg.a D:/Qt/5.15.0/wasm_32/plugins/imageformats/libqtga.a D:/Qt/5.15.0/wasm_32/plugins/imageformats/libqtiff.a D:/Qt/5.15.0/wasm_32/plugins/imageformats/libqwbmp.a D:/Qt/5.15.0/wasm_32/plugins/imageformats/libqwebp.a D:/Qt/5.15.0/wasm_32/qml/QtQuick.2/libqtquick2plugin.a D:/Qt/5.15.0/wasm_32/qml/QtQuick/Window.2/libwindowplugin.a D:/Qt/5.15.0/wasm_32/lib/libQt5Quick.a D:/Qt/5.15.0/wasm_32/lib/libQt5QmlModels.a D:/Qt/5.15.0/wasm_32/lib/libQt5Qml.a D:/Qt/5.15.0/wasm_32/lib/libQt5Gui.a D:/Qt/5.15.0/wasm_32/lib/libqtlibpng.a D:/Qt/5.15.0/wasm_32/lib/libqtharfbuzz.a D:/Qt/5.15.0/wasm_32/lib/libQt5Network.a D:/Qt/5.15.0/wasm_32/lib/libQt5Core.a D:/Qt/5.15.0/wasm_32/lib/libqtpcre2.a   
    Exception in thread Thread-6:
    Traceback (most recent call last):
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\threading.py", line 926, in _bootstrap_inner
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\threading.py", line 870, in run
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 1238, in _readerthread
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\cp1252.py", line 23, in decode
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 17942: character maps to <undefined>
    
    multiprocessing.pool.RemoteTraceback: 
    """
    Traceback (most recent call last):
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\pool.py", line 121, in worker
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\pool.py", line 44, in mapstar
      File "D:\Projects\Qt\_SDK\emsdk\fastcomp\emscripten\tools\shared.py", line 1305, in g_llvm_nm_uncached
        return Building.llvm_nm_uncached(filename)
      File "D:\Projects\Qt\_SDK\emsdk\fastcomp\emscripten\tools\shared.py", line 2116, in llvm_nm_uncached
        proc = run_process([LLVM_NM, filename], stdout=stdout, stderr=stderr, check=False)
      File "D:\Projects\Qt\_SDK\emsdk\fastcomp\emscripten\tools\shared.py", line 181, in run_process
        ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 474, in run
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 939, in communicate
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\subprocess.py", line 1290, in _communicate
    IndexError: list index out of range
    """
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "D:\Projects\Qt\_SDK\emsdk\fastcomp\emscripten\emcc.py", line 3905, in <module>
        sys.exit(run(sys.argv))
      File "D:\Projects\Qt\_SDK\emsdk\fastcomp\emscripten\emcc.py", line 2205, in run
        extra_files_to_link += system_libs.calculate([f for _, f in sorted(temp_files)] + extra_files_to_link, in_temp, stdout_=None, stderr_=None, forced=forced_stdlibs)
      File "D:\Projects\Qt\_SDK\emsdk\fastcomp\emscripten\tools\system_libs.py", line 1364, in calculate
        symbolses = shared.Building.parallel_llvm_nm([os.path.abspath(t) for t in temp_files])
      File "D:\Projects\Qt\_SDK\emsdk\fastcomp\emscripten\tools\shared.py", line 1682, in parallel_llvm_nm
        object_contents = pool.map(g_llvm_nm_uncached, files)
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\pool.py", line 268, in map
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\pool.py", line 657, in get
    IndexError: list index out of range
    mingw32-make: *** [Makefile:73: .\untitled1.js] Error 1
    14:40:49: The process "D:\Qt\Tools\mingw810_64\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project untitled1 (kit: Qt 5.15.0 WebAssembly)
    When executing step "Make"
    14:40:49: Elapsed time: 00:05.
    

    741cc65e-d9b6-4f7e-a962-3880791ed407-image.png

    91b13b1a-1f96-4ac4-8298-9c11e7441f42-image.png



  • @kirill_f
    Problem solved. I just installed upstream version of emscrypten instead of fastcomp.

    emsdk install sdk-upstream-1.39.8-64bit
    emsdk activate sdk-upstream-1.39.8-64bit
    

Log in to reply