Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Error building under webassembly
Forum Updated to NodeBB v4.3 + New Features

Error building under webassembly

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
9 Posts 3 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anton1978
    wrote on 17 Sept 2024, 22:48 last edited by
    #1

    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 this

    01: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?

    J 1 Reply Last reply 18 Sept 2024, 06:20
    0
    • A Offline
      A Offline
      Axel Spoerl
      Moderators
      wrote on 22 Sept 2024, 11:34 last edited by
      #7

      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.

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      1
      • A Anton1978
        17 Sept 2024, 22:48

        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 this

        01: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?

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 18 Sept 2024, 06:20 last edited by
        #2

        @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?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Anton1978
          wrote on 18 Sept 2024, 06:59 last edited by
          #3

          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();
          }
          
          1 Reply Last reply
          0
          • A Offline
            A Offline
            Axel Spoerl
            Moderators
            wrote on 19 Sept 2024, 05:33 last edited by
            #4

            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.

            Software Engineer
            The Qt Company, Oslo

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Anton1978
              wrote on 22 Sept 2024, 11:24 last edited by
              #5

              I installed emscripten according to these instructions https://emscripten.org/docs/getting_started/downloads.html

              1. installed python, downloaded emscripten, installed webassembly in the qt maintenance tool
              2. entered emsdk.bat install latest into cmd
              3. entered emsdk.bat activate latest into cmd
              4. set environment variables manually
              5. configured webassembly in devices in QtCreator

              That's it, did I miss something?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Anton1978
                wrote on 22 Sept 2024, 11:28 last edited by
                #6

                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
                alt text
                alt text
                alt text
                alt text

                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

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  Axel Spoerl
                  Moderators
                  wrote on 22 Sept 2024, 11:34 last edited by
                  #7

                  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.

                  Software Engineer
                  The Qt Company, Oslo

                  1 Reply Last reply
                  1
                  • A Offline
                    A Offline
                    Anton1978
                    wrote on 22 Sept 2024, 19:21 last edited by Anton1978
                    #8

                    Qt 6.7 but emscripten 3.1.67.
                    possibly this is the problem, I'll try to reinstall it.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Anton1978
                      wrote on 22 Sept 2024, 19:46 last edited by
                      #9

                      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 ;-)

                      1 Reply Last reply
                      1
                      • A Anton1978 has marked this topic as solved on 22 Sept 2024, 19:47

                      1/9

                      17 Sept 2024, 22:48

                      • Login

                      • Login or register to search.
                      1 out of 9
                      • First post
                        1/9
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved