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. Duplicate symbol: blake2b when linking with libsodium
QtWS25 Last Chance

Duplicate symbol: blake2b when linking with libsodium

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
wasmlink errorlibsodiumstatic
2 Posts 1 Posters 604 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.
  • M Offline
    M Offline
    Mesrine
    wrote on 15 Dec 2022, 02:09 last edited by Mesrine
    #1

    Hi,

    I have developed a library that use "QbyteArray" from Qt and also libsodium functions like "crypto_sign_seed_keypair".

    When compiling to wasm the library builds.
    But when compiling an executable that depends on the library and call functions that will call "crypto_sign_seed_keypair"(of libsodium) the linker complains about duplicate symbols.
    Specifically, when doing make step:

    make
    [ 16%] Building CXX object _deps/ed25519-build/CMakeFiles/ed25519.dir/ed25519.cpp.o
    [ 33%] Linking CXX static library libed25519.a
    [ 33%] Built target ed25519
    [ 50%] Building CXX object CMakeFiles/qed25519.dir/qed25519.cpp.o
    [ 66%] Linking CXX static library libqed25519.a
    [ 66%] Built target qed25519
    [ 83%] Building CXX object tests/CMakeFiles/test1.dir/test1.cpp.o
    [100%] Linking CXX executable test1.js
    wasm-ld: error: duplicate symbol: blake2b_init_param
    >>> defined in /home/user/Qt/6.3.1/wasm_32/lib/libQt6Core.a(qcryptographichash.cpp.o)
    >>> defined in /home/user/WASM/LATEST/libsodium-stable/libsodium-js/lib/libsodium.a(libsodium_la-blake2b-ref.o)
    
    wasm-ld: error: duplicate symbol: blake2b_init
    >>> defined in /home/user/Qt/6.3.1/wasm_32/lib/libQt6Core.a(qcryptographichash.cpp.o)
    >>> defined in /home/user/WASM/LATEST/libsodium-stable/libsodium-js/lib/libsodium.a(libsodium_la-blake2b-ref.o)
    
    wasm-ld: error: duplicate symbol: blake2b_init_key
    >>> defined in /home/user/Qt/6.3.1/wasm_32/lib/libQt6Core.a(qcryptographichash.cpp.o)
    >>> defined in /home/user/WASM/LATEST/libsodium-stable/libsodium-js/lib/libsodium.a(libsodium_la-blake2b-ref.o)
    
    wasm-ld: error: duplicate symbol: blake2b_final
    >>> defined in /home/user/Qt/6.3.1/wasm_32/lib/libQt6Core.a(qcryptographichash.cpp.o)
    >>> defined in /home/user/WASM/LATEST/libsodium-stable/libsodium-js/lib/libsodium.a(libsodium_la-blake2b-ref.o)
    
    wasm-ld: error: duplicate symbol: blake2b
    >>> defined in /home/user/Qt/6.3.1/wasm_32/lib/libQt6Core.a(qcryptographichash.cpp.o)
    >>> defined in /home/user/WASM/LATEST/libsodium-stable/libsodium-js/lib/libsodium.a(libsodium_la-blake2b-ref.o)
    

    It seems that both static libraries qt6Core and libsodium use the same blake2b source codes.
    I need both libraries(qt6Core and libsodium) in my library.
    But I do not need to link to qcryptographichash.cpp.o object.
    How can i neglect this object when linking using emscripten?
    I use cmake.

    I will much appreciate if some one advise me on how to resolve this.
    Thanks for your time.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mesrine
      wrote on 15 Dec 2022, 13:13 last edited by
      #2

      I noticed that ed25519 do not need blake2b. A temporal solution was to remove the object "libsodium_la-blake2b-ref.o" from libsodium.a by using

       ar dv libsodium.a libsodium_la-blake2b-ref.o
      

      I can not remove "qcryptographichash.cpp.o" from libQt6Core.a because I use that on other libraries.

      1 Reply Last reply
      0

      2/2

      15 Dec 2022, 13:13

      • Login

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