Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. WebAssembly undefined symbol: emscripten_fetch
Forum Updated to NodeBB v4.3 + New Features

WebAssembly undefined symbol: emscripten_fetch

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 1.4k 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.
  • EndrII 0E Offline
    EndrII 0E Offline
    EndrII 0
    wrote on last edited by
    #1

    Hi. I am try build me project for web with cmake build system.
    But i have a link error.

    error: undefined symbol: emscripten_fetch
    warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
    warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
    error: undefined symbol: emscripten_fetch_attr_init
    error: undefined symbol: emscripten_fetch_close
    error: undefined symbol: emscripten_fetch_get_response_headers
    error: undefined symbol: emscripten_fetch_get_response_headers_length
    Error: Aborting compilation due to previous errors
    shared:ERROR: '/media/E/builds/emsdk/node/12.9.1_64bit/bin/node /media/E/builds/emsdk/upstream/emscripten/src/compiler.js /tmp/tmpmlllt5bk.txt' failed (1)
    make[2]: *** [Site/CMakeFiles/Site.dir/build.make:410: ../Site/build/Release/Site.js] Ошибка 1
    make[1]: *** [CMakeFiles/Makefile2:245: Site/CMakeFiles/Site.dir/all] Ошибка 2
    make: *** [Makefile:104: all] Ошибка 2
    

    Qt version: 5.15.0
    em++ version : 1.39.8

    my custom link flags :

    add_link_options("--bind")
    

    my cmake command :

    cmake -DCMAKE_TOOLCHAIN_FILE=/media/E/builds/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_PREFIX_PATH=/home/andrei/Qt/5.15.0/wasm_32 -DQt5_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5 -DQt5Core_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Core -DQt5Widgets_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Widgets -DQt5Gui_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Gui -DQt5Quick_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Quick -DQt5QmlModels_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5QmlModels -DQt5Qml_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Qml -DQt5Network_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Network -DQt5Svg_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Svg -DQt5Zlib_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Zlib -DQt5VirtualKeyboard_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5VirtualKeyboard -DQt5EventDispatcherSupport_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5EventDispatcherSupport -DQt5FontDatabaseSupport_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5FontDatabaseSupport -DQt5LinguistTools_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5LinguistTools -DQt5ThemeSupport_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5ThemeSupport -DQt5WebSockets_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5WebSockets -DQt5EglSupport_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5EglSupport -DQt5QuickControls2_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5QuickControls2 
    

    what could be the problem and how to solve it?

    EndrII 0E 1 Reply Last reply
    1
    • EndrII 0E EndrII 0

      Hi. I am try build me project for web with cmake build system.
      But i have a link error.

      error: undefined symbol: emscripten_fetch
      warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
      warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
      error: undefined symbol: emscripten_fetch_attr_init
      error: undefined symbol: emscripten_fetch_close
      error: undefined symbol: emscripten_fetch_get_response_headers
      error: undefined symbol: emscripten_fetch_get_response_headers_length
      Error: Aborting compilation due to previous errors
      shared:ERROR: '/media/E/builds/emsdk/node/12.9.1_64bit/bin/node /media/E/builds/emsdk/upstream/emscripten/src/compiler.js /tmp/tmpmlllt5bk.txt' failed (1)
      make[2]: *** [Site/CMakeFiles/Site.dir/build.make:410: ../Site/build/Release/Site.js] Ошибка 1
      make[1]: *** [CMakeFiles/Makefile2:245: Site/CMakeFiles/Site.dir/all] Ошибка 2
      make: *** [Makefile:104: all] Ошибка 2
      

      Qt version: 5.15.0
      em++ version : 1.39.8

      my custom link flags :

      add_link_options("--bind")
      

      my cmake command :

      cmake -DCMAKE_TOOLCHAIN_FILE=/media/E/builds/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_PREFIX_PATH=/home/andrei/Qt/5.15.0/wasm_32 -DQt5_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5 -DQt5Core_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Core -DQt5Widgets_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Widgets -DQt5Gui_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Gui -DQt5Quick_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Quick -DQt5QmlModels_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5QmlModels -DQt5Qml_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Qml -DQt5Network_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Network -DQt5Svg_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Svg -DQt5Zlib_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5Zlib -DQt5VirtualKeyboard_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5VirtualKeyboard -DQt5EventDispatcherSupport_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5EventDispatcherSupport -DQt5FontDatabaseSupport_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5FontDatabaseSupport -DQt5LinguistTools_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5LinguistTools -DQt5ThemeSupport_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5ThemeSupport -DQt5WebSockets_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5WebSockets -DQt5EglSupport_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5EglSupport -DQt5QuickControls2_DIR=/home/andrei/Qt/5.15.0/wasm_32/lib/cmake/Qt5QuickControls2 
      

      what could be the problem and how to solve it?

      EndrII 0E Offline
      EndrII 0E Offline
      EndrII 0
      wrote on last edited by
      #2

      @EndrII-0

      i am found solution.

      I needed to link the project with the following flags:

       -s FETCH=1 --bind
      

      in order to add these options to the cmake assembly, add the following line to the main CMakeList.txt:

      add_link_options("SHELL:-s FETCH=1")
      add_link_options("--bind")
      

      I also looked at the output of qmake. and I think I need to add some more build flags.

      
      add_link_options("SHELL:-s FETCH=1")
      add_link_options("SHELL:-s WASM=1")
      add_link_options("SHELL:-s FULL_ES2=1")
      add_link_options("SHELL:-s FULL_ES3=1")
      add_link_options("SHELL:-s USE_WEBGL2=1")
      add_link_options("SHELL:-s EXIT_RUNTIME=1")
      add_link_options("SHELL:-s ERROR_ON_UNDEFINED_SYMBOLS=1")
      add_link_options("SHELL:-s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"]")
      
      add_link_options("--bind")
      
      
      1 Reply Last reply
      2

      • Login

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