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. Need help resolving undefined symbols at compile time

Need help resolving undefined symbols at compile time

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
5 Posts 4 Posters 1.8k Views
  • 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.
  • C Offline
    C Offline
    CodeFan
    wrote on 29 May 2022, 14:50 last edited by
    #1

    I am brand new to Web Assembly. I have a small Qt Widgets app that builds and runs fine on my KDE Neon (Ubuntu 20.4) Linux desktop using Qt Creator with Qt 6.3.0 and gcc 9.4.0. When I would start Qt Creator, it would put a note along the bottom saying I did not have a Web Assembly kit configured. I clicked the setup button. It directed me to a page for installing emsdk. I cloned that repo and ran through the few commands to install it and put it in my PATH. Qt Creator then found the emsdk and configured the kit. I tried building my project, which uses CMake. I get a few undefined symbol errors (below) before em++ stops. I've read about building Qt from source for cross compiling. Is that something I need to do even though I included Web Assembly during the Qt installation? Any help would be much appreciated!

    error: undefined symbol: _ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv (referenced by top-level compiled C/C++ code)
    warning: Link with -sLLD_REPORT_UNDEFINED to get more information on undefined symbols
    warning: To disable errors for undefined symbols use -sERROR_ON_UNDEFINED_SYMBOLS=0
    warning: __ZNKSt3__220__vector_base_commonILb1EE20__throw_length_errorEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
    error: undefined symbol: _ZNKSt3__221__basic_string_commonILb1EE20__throw_length_errorEv (referenced by top-level compiled C/C++ code)
    warning: __ZNKSt3__221__basic_string_commonILb1EE20__throw_length_errorEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
    error: undefined symbol: _ZNKSt3__221__basic_string_commonILb1EE20__throw_out_of_rangeEv (referenced by top-level compiled C/C++ code)
    warning: __ZNKSt3__221__basic_string_commonILb1EE20__throw_out_of_rangeEv may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
    Error: Aborting compilation due to previous errors

    1 Reply Last reply
    0
    • C Offline
      C Offline
      CodeFan
      wrote on 12 Jun 2022, 15:27 last edited by
      #2

      I posted this reply in another thread I had started to ask about example source. But, I figured I would post it here, since this is the thread it belongs in.

      I can build and run c++ test apps with the emsdk and load them in a browser without any issue. I did have to add a flag to the emcc command line to enable exceptions. But, I later went into the emsdk's settings.js and changed DISABLE_EXCEPTION_CATCHING to false. Now I can build with emcc and run in the browser without specifying the option on the command line. Unfortunately, none of this has helped me when building within Qt Creator. I still get the same unresolved functions. The odd part is that, despite me modifying settings.js, I still see that the emcc command that Qt is executing has DISABLE_EXCEPTION_CATCHING=1. I don't see where this is being set in the project or kit settings. I've tried adding "-s DISABLE_EXCEPTION_CATCHING=0" in my CMakeLists.txt via add_compile_options() and add_link_options(). It still doesn't change it.

      Does anyone know if that is what is causing the errors?

      Does anyone know how I tell Qt to stop setting DISABLE_EXCEPTION_CATCHING to 1?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SandeepKg1
        wrote on 22 Dec 2022, 05:27 last edited by
        #3

        You have to make changes in makefile -sERROR_ON_UNDEFINED_SYMBOLS=0.

        J 1 Reply Last reply 22 Dec 2022, 06:10
        0
        • S SandeepKg1
          22 Dec 2022, 05:27

          You have to make changes in makefile -sERROR_ON_UNDEFINED_SYMBOLS=0.

          J Online
          J Online
          jsulm
          Lifetime Qt Champion
          wrote on 22 Dec 2022, 06:10 last edited by
          #4

          @SandeepKg1 It is a bad idea to edit generated makefiles. And disabling the errors instead of solving the actual issue is also a bad idea.

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

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lorn.potter
            wrote on 27 Dec 2022, 22:16 last edited by
            #5

            For Qt 6.3.0 you need Emscripten 3.0.0. Is that what you have installed?

            Those errors look like something that happens when a mis-match of Emscripten versions are used, where Qt uses one version and a developer uses a different one.

            Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
            Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

            1 Reply Last reply
            0

            • Login

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