Error building under webassembly
-
Good night.
Finally I won the installation of webassembly for Windows)) and happily began assembling the first project. Well, just to see what it's like. But the project gives an error - :-1: error: ninja: build stopped: subcommand failed.
The build output is like this01:00:44: Выполняются этапы для проекта Test03... 01:00:44: Запускается: «C:\Qt\Tools\CMake_64\bin\cmake.exe» --build E:/QML/Test03/build/WebAssembly_Qt_6_7_2_multi_threaded-Debug --target all [1/6 13,2/sec] Copying Main.qml to E:/QML/Test03/build/WebAssembly_Qt_6_7_2_multi_threaded-Debug/Test03/Main.qml [2/6 17,4/sec] Running rcc for resource appTest03_raw_qml_0 [3/6 16,4/sec] Generating .rcc/qmlcache/appTest03_Main_qml.cpp [4/6 11,4/sec] Building CXX object CMakeFiles/appTest03.dir/build/WebAssembly_Qt_6_7_2_multi_threaded-Debug/.qt/rcc/qrc_appTest03_raw_qml_0.cpp.o [5/6 2,7/sec] Building CXX object CMakeFiles/appTest03.dir/build/WebAssembly_Qt_6_7_2_multi_threaded-Debug/.rcc/qmlcache/appTest03_Main_qml.cpp.o [6/6 2,0/sec] Linking CXX executable appTest03.js FAILED: appTest03.js C:\Windows\system32\cmd.exe /C "cd . && C:\emsdk\upstream\emscripten\em++.bat -DQT_QML_DEBUG -g -s PTHREAD_POOL_SIZE=4 -s INITIAL_MEMORY=50MB -s MAXIMUM_MEMORY=4GB -s EXPORTED_RUNTIME_METHODS=UTF16ToString,stringToUTF16,JSEvents,specialHTMLTargets,FS,callMain -s EXPORT_NAME=appTest03_entry -s MAX_WEBGL_VERSION=2 -s FETCH=1 -s WASM_BIGINT=1 -s STACK_SIZE=5MB -s MODULARIZE=1 -s DISABLE_EXCEPTION_CATCHING=1 -pthread -s ALLOW_MEMORY_GROWTH -s DEMANGLE_SUPPORT=1 --profiling-funcs -sASYNCIFY_IMPORTS=qt_asyncify_suspend_js,qt_asyncify_resume_js -s ERROR_ON_UNDEFINED_SYMBOLS=1 @CMakeFiles\appTest03.rsp -o appTest03.js && cd ." em++: warning: DEMANGLE_SUPPORT is deprecated (mangled names no longer appear in stack traces). Please open a bug if you have a continuing need for this setting [-Wdeprecated] em++: warning: -pthread + ALLOW_MEMORY_GROWTH may run non-wasm code slowly, see https://github.com/WebAssembly/design/issues/1271 [-Wpthreads-mem-growth] warning: JS library symbol '$demangle' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated] warning: JS library symbol '$stackTrace' is deprecated. Please open a bug if you have a continuing need for this symbol [-Wdeprecated] error: undefined symbol: saveSetjmp (referenced by root reference (e.g. compiled C/C++ code)) warning: To disable errors for undefined symbols use `-sERROR_ON_UNDEFINED_SYMBOLS=0` warning: _saveSetjmp may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library error: undefined symbol: testSetjmp (referenced by root reference (e.g. compiled C/C++ code)) warning: _testSetjmp may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library Error: Aborting compilation due to previous errors em++: error: 'C:/emsdk/node/18.20.3_64bit/bin/node.exe C:\emsdk\upstream\emscripten\src\compiler.mjs C:\Users\Anton\AppData\Local\Temp\tmpfxpk0_m1.json' failed (returned 1) ninja: build stopped: subcommand failed. 01:00:47: Процесс «C:\Qt\Tools\CMake_64\bin\cmake.exe» завершился с кодом 1. Ошибка при сборке/развёртывании проекта Test03 (комплект: WebAssembly Qt 6.7.2 (multi-threaded)) Во время выполнения этапа «Собрать» 01:00:47: Прошло времени: 00:03.
It is not clear what is happening. I haven't worked with webassembly before. What does he need?
-
Please don't post links to external sites here. Just post your relevant code snippets / screenshots directly.
Please also answer all my questions:Which version of Qt?
Emscripten and Qt versions have to match, see here.
If you use Qt 6.7, emscripten 3.1.50 is needed. -
@Anton1978 said in Error building under webassembly:
error: undefined symbol: saveSetjmp (referenced by root reference (e.g. compiled C/C++ code))
This is the actual error.
Is saveSetjmp something you wrote? -
No.
I didn't write anything at all, I tried to compile the helloword.import QtQuick Window { id: root width: 640 height: 480 visible: true title: qsTr("Hello World") }
and
#include <QGuiApplication> #include <QQmlApplicationEngine> int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine; QObject::connect( &engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.loadFromModule("Test03", "Main"); return app.exec(); }
-
How have you installed webassembly? Which version of Qt?
If memory serves well, saveSetjmp is from the ooct library and has to be built with emscripten. Looks as if the installation as such is broken and/or 3rd party stuff is missing. -
I installed emscripten according to these instructions https://emscripten.org/docs/getting_started/downloads.html
- installed python, downloaded emscripten, installed webassembly in the qt maintenance tool
- entered emsdk.bat install latest into cmd
- entered emsdk.bat activate latest into cmd
- set environment variables manually
- configured webassembly in devices in QtCreator
That's it, did I miss something?
-
And I was sure that it was enough to install Emscripten and configure the build kit in QtCreator. Apparently this is not the case.
This is what my settings look like now
duplicate links
https://cloud.mail.ru/public/ejW2/1dkNS43hU
https://cloud.mail.ru/public/Qgz9/RnyHxCpPY
https://cloud.mail.ru/public/cukb/gvhSEjVcH
https://cloud.mail.ru/public/x5x2/kickDcrqS -
Please don't post links to external sites here. Just post your relevant code snippets / screenshots directly.
Please also answer all my questions:Which version of Qt?
Emscripten and Qt versions have to match, see here.
If you use Qt 6.7, emscripten 3.1.50 is needed. -
Amazing. Thank you very much, this really works.
True, I didn’t understand where in your link to look at the correspondence between the versions of emscripten and Qt, but if you build using version emscripten 3.1.50 with Qt 6.7, then everything works fine. This is the first webassembly application in my life ;-) -