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. wasm-ld: error: duplicate symbol from libqt6core
Forum Updated to NodeBB v4.3 + New Features

wasm-ld: error: duplicate symbol from libqt6core

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
3 Posts 2 Posters 52 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.
  • KyefK Online
    KyefK Online
    Kyef
    wrote last edited by
    #1

    I am getting an error regarding duplicate symbols. My search indicates libqt6core.a is being included in two or more different places and therefore wasm-ld fails to link the library as symbols are defined in multiple times. I cannot locate where this library/symbols are included but the problem arise when I include Sql required component and Qt6::Network target_link_libraries in cmake. Below is the Compilation output from the linking stage. Whoever picks interest in this can help:

    [26/26 0.9/sec] Linking CXX executable Debug\appdemoApp.js
    FAILED: Debug/appdemoApp.js 
    cmd.exe /C "cd . && C:\Qt\emsdk\upstream\emscripten\em++.bat -DQT_QML_DEBUG -g -s MODULARIZE=1 -s EXPORT_NAME=appdemoApp_entry -s EXPORTED_RUNTIME_METHODS=UTF16ToString,stringToUTF16,JSEvents,specialHTMLTargets,FS,callMain -s INITIAL_MEMORY=50MB -s MAXIMUM_MEMORY=4GB -s MAX_WEBGL_VERSION=2 -s WASM_BIGINT=1 -s STACK_SIZE=5MB -s ALLOW_MEMORY_GROWTH --profiling-funcs -sERROR_ON_UNDEFINED_SYMBOLS=1 -sFETCH -sLINKABLE=1 -sEXPORT_ALL=1 -sSHARED_MEMORY=0 @CMakeFiles\appdemoApp.Debug.rsp -o Debug\appdemoApp.js  && cmd.exe /C "cd /D D:\Qt\Projects\build-demoApp-WebAssembly_Qt_6_9_1_single_threaded && C:\Qt\Tools\CMake_64\bin\cmake.exe -E copy_if_different D:/Qt/Projects/build-demoApp-WebAssembly_Qt_6_9_1_single_threaded/appdemoApp.html D:/Qt/Projects/build-demoApp-WebAssembly_Qt_6_9_1_single_threaded/Debug/appdemoApp.html && cd /D D:\Qt\Projects\build-demoApp-WebAssembly_Qt_6_9_1_single_threaded && C:\Qt\Tools\CMake_64\bin\cmake.exe -E copy_if_different C:/Qt/6.9.1/wasm_singlethread/plugins/platforms/qtloader.js D:/Qt/Projects/build-demoApp-WebAssembly_Qt_6_9_1_single_threaded/Debug/qtloader.js && cd /D D:\Qt\Projects\build-demoApp-WebAssembly_Qt_6_9_1_single_threaded && C:\Qt\Tools\CMake_64\bin\cmake.exe -E copy_if_different C:/Qt/6.9.1/wasm_singlethread/plugins/platforms/qtlogo.svg D:/Qt/Projects/build-demoApp-WebAssembly_Qt_6_9_1_single_threaded/Debug/qtlogo.svg""
    wasm-ld: error: duplicate symbol: qDetectCpuFeatures
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
    
    wasm-ld: error: duplicate symbol: qt_cpu_features
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
    
    wasm-ld: error: duplicate symbol: qDumpCPUFeatures()
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
    
    wasm-ld: error: duplicate symbol: qHashBits(void const*, unsigned long, unsigned long)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qHash(QByteArrayView, unsigned long)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qHash(QStringView, unsigned long)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qHash(QBitArray const&, unsigned long)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qHash(QLatin1String, unsigned long)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: QHashSeed::globalSeed()
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: QHashSeed::setDeterministicGlobalSeed()
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: QHashSeed::resetRandomGlobalSeed()
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qGlobalQHashSeed()
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qSetGlobalQHashSeed(int)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qt_hash(QStringView, unsigned int)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qHash(double, unsigned long)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: qHash(long double, unsigned long)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
    
    wasm-ld: error: duplicate symbol: QByteArray::isNull() const
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
    
    wasm-ld: error: duplicate symbol: QByteArray::indexOf(char, int) const
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
    
    wasm-ld: error: duplicate symbol: QByteArray::lastIndexOf(char, int) const
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
    
    wasm-ld: error: duplicate symbol: QDataStream::status() const
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
    >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
    
    wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
    em++: error: 'C:/Qt/emsdk/upstream/bin\wasm-ld.exe @C
    

    Thank you in advance

    Kyef Elliot
    If Can Imagine It...I Can Do It!!

    jsulmJ 1 Reply Last reply
    0
    • KyefK Kyef

      I am getting an error regarding duplicate symbols. My search indicates libqt6core.a is being included in two or more different places and therefore wasm-ld fails to link the library as symbols are defined in multiple times. I cannot locate where this library/symbols are included but the problem arise when I include Sql required component and Qt6::Network target_link_libraries in cmake. Below is the Compilation output from the linking stage. Whoever picks interest in this can help:

      [26/26 0.9/sec] Linking CXX executable Debug\appdemoApp.js
      FAILED: Debug/appdemoApp.js 
      cmd.exe /C "cd . && C:\Qt\emsdk\upstream\emscripten\em++.bat -DQT_QML_DEBUG -g -s MODULARIZE=1 -s EXPORT_NAME=appdemoApp_entry -s EXPORTED_RUNTIME_METHODS=UTF16ToString,stringToUTF16,JSEvents,specialHTMLTargets,FS,callMain -s INITIAL_MEMORY=50MB -s MAXIMUM_MEMORY=4GB -s MAX_WEBGL_VERSION=2 -s WASM_BIGINT=1 -s STACK_SIZE=5MB -s ALLOW_MEMORY_GROWTH --profiling-funcs -sERROR_ON_UNDEFINED_SYMBOLS=1 -sFETCH -sLINKABLE=1 -sEXPORT_ALL=1 -sSHARED_MEMORY=0 @CMakeFiles\appdemoApp.Debug.rsp -o Debug\appdemoApp.js  && cmd.exe /C "cd /D D:\Qt\Projects\build-demoApp-WebAssembly_Qt_6_9_1_single_threaded && C:\Qt\Tools\CMake_64\bin\cmake.exe -E copy_if_different D:/Qt/Projects/build-demoApp-WebAssembly_Qt_6_9_1_single_threaded/appdemoApp.html D:/Qt/Projects/build-demoApp-WebAssembly_Qt_6_9_1_single_threaded/Debug/appdemoApp.html && cd /D D:\Qt\Projects\build-demoApp-WebAssembly_Qt_6_9_1_single_threaded && C:\Qt\Tools\CMake_64\bin\cmake.exe -E copy_if_different C:/Qt/6.9.1/wasm_singlethread/plugins/platforms/qtloader.js D:/Qt/Projects/build-demoApp-WebAssembly_Qt_6_9_1_single_threaded/Debug/qtloader.js && cd /D D:\Qt\Projects\build-demoApp-WebAssembly_Qt_6_9_1_single_threaded && C:\Qt\Tools\CMake_64\bin\cmake.exe -E copy_if_different C:/Qt/6.9.1/wasm_singlethread/plugins/platforms/qtlogo.svg D:/Qt/Projects/build-demoApp-WebAssembly_Qt_6_9_1_single_threaded/Debug/qtlogo.svg""
      wasm-ld: error: duplicate symbol: qDetectCpuFeatures
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
      
      wasm-ld: error: duplicate symbol: qt_cpu_features
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
      
      wasm-ld: error: duplicate symbol: qDumpCPUFeatures()
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qsimd.cpp.o)
      
      wasm-ld: error: duplicate symbol: qHashBits(void const*, unsigned long, unsigned long)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qHash(QByteArrayView, unsigned long)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qHash(QStringView, unsigned long)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qHash(QBitArray const&, unsigned long)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qHash(QLatin1String, unsigned long)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: QHashSeed::globalSeed()
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: QHashSeed::setDeterministicGlobalSeed()
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: QHashSeed::resetRandomGlobalSeed()
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qGlobalQHashSeed()
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qSetGlobalQHashSeed(int)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qt_hash(QStringView, unsigned int)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qHash(double, unsigned long)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: qHash(long double, unsigned long)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(qhash.cpp.o)
      
      wasm-ld: error: duplicate symbol: QByteArray::isNull() const
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
      
      wasm-ld: error: duplicate symbol: QByteArray::indexOf(char, int) const
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
      
      wasm-ld: error: duplicate symbol: QByteArray::lastIndexOf(char, int) const
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
      
      wasm-ld: error: duplicate symbol: QDataStream::status() const
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
      >>> defined in C:/Qt/6.9.1/wasm_singlethread/lib/libQt6Core.a(removed_api.cpp.o)
      
      wasm-ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
      em++: error: 'C:/Qt/emsdk/upstream/bin\wasm-ld.exe @C
      

      Thank you in advance

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote last edited by
      #2

      @Kyef How does your CMakeLists.txt file look like?

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

      1 Reply Last reply
      0
      • KyefK Online
        KyefK Online
        Kyef
        wrote last edited by Kyef
        #3

        Thank you @jsulm for the response. Here is my CMakeLists.txt below:

        CMakeLists.txt
        cmake_minimum_required(VERSION 3.16)
        
        project(demoApp VERSION 0.1 LANGUAGES CXX)
        
        set(CMAKE_CXX_STANDARD_REQUIRED ON)
        set(CMAKE_AUTOMOC ON)
        set(QT_QML_GENERATE_QMLLS_INI ON)
        find_package(Qt6 6.4 REQUIRED COMPONENTS
            Quick
            Network
            Sql
            WebSockets
        )
        # find_package(MySQL REQUIRED)
        qt_standard_project_setup(REQUIRES 6.4)
        qt_policy(SET QTP0001 NEW)
        
        qt_add_executable(appdemoApp
            main.cpp
        )
        qt_add_qml_module(appdemoApp
            URI demoApp
            VERSION 1.0
            RESOURCE_PREFIX /
        
            SOURCES
            mainworker.h mainworker.cpp
            applogger.h applogger.cpp
        
            icons/Resource.qrc
            QML_FILES
                Main.qml
                Login.qml
                Userreg.qml
        )
        
        # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
        # If you are developing for iOS or macOS you should consider setting an
        # explicit, fixed bundle identifier manually though.
        set_target_properties(appdemoApp PROPERTIES
        #    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appdemoApp
            MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
            MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
            MACOSX_BUNDLE TRUE
            WIN32_EXECUTABLE TRUE
        )
        
        target_link_libraries(appdemoApp
            PRIVATE Qt6::Quick
            PRIVATE Qt6::Network
            PRIVATE Qt6::Sql
            PRIVATE Qt6::WebSockets
        )
        
        include(GNUInstallDirs)
        
        
        install(TARGETS appdemoApp
            BUNDLE DESTINATION .
            LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
            RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
        )
        

        I was thinking I could be linking to a wrong library and mysql include directory however, Cmake runs the configurations very well and indicated MYSQL:MYSQL is found.

        Kyef Elliot
        If Can Imagine It...I Can Do It!!

        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