emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.36k stars 3.25k forks source link

Duplicate symbol: emscripten_webgl_init_context_attributes #22075

Open poretga99 opened 3 weeks ago

poretga99 commented 3 weeks ago

I have some problems regarding OpenGL emulation with EMSDK 3.1.60.

Is it possible to ignore the duplicated symbols? I was trying with add_link_options(<target> PRIVATE --allow-multiple-definition) but with no success.

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.60 (42a6ea2052f19f70d7d994e8c324bcad2f1f8939)
clang version 19.0.0git (https:/github.com/llvm/llvm-project bc9823cf60bf91cc8b45248c4205cd2c67b2a3d5)
Target: wasm32-unknown-emscripten
Thread model: posix

Failing command line in full:


[2/3][00:01 + 00:00] Linking CXX executable bin\wasm2.html
FAILED: bin/wasm2.html 
C:\WINDOWS\system32\cmd.exe /C "cd . && D:\_conan\p\b\emsdkbd647c4c78dd5\p\bin\upstream\emscripten\em++.bat -stdlib=libc++ -pthread -sSHARED_MEMORY=1 -sUSE_PTHREADS=1 -Wno-narrowing -Werror=return-stack-address -Werror=return-type -Werror=header-guard -Werror=literal-conversion -Werror=switch -Werror=array-bounds -Werror=mismatched-new-delete -Werror=constant-conversion -Werror=nonportable-include-path -Wno-inconsistent-missing-override -Wno-final-dtor-non-final-class -Wno-ambiguous-reversed-operator -Wno-format -Wno-dangling-else -Wno-braced-scalar-init -Wno-comment -Wno-constant-conversion -ftime-trace   -O3 -DNDEBUG -pthread -sSHARED_MEMORY=1 -sUSE_PTHREADS=1 -sMALLOC=mimalloc      -fuse-ld=lld -v -sLEGACY_GL_EMULATION --bind -sMALLOC=mimalloc -error-limit=0 @CMakeFiles\wasm2.rsp -o bin\wasm2.html  && cd ."
 "D:/_conan/p/b/emsdkbd647c4c78dd5/p/bin/upstream/bin\clang.exe" --version
 "D:/_conan/p/b/emsdkbd647c4c78dd5/p/bin/upstream/bin\wasm-ld.exe" @C:\Users\Martin\AppData\Local\Temp\emscripten_qx5196_8.rsp.utf-8
wasm-ld: error: duplicate symbol: emscripten_webgl_init_context_attributes
>>> defined in D:/_conan/p/b/emsdkbd647c4c78dd5/p/bin/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libGL.a(webgl1.o)
>>> defined in D:\\_conan\\p\\b\\emsdkbd647c4c78dd5\\p\\bin\\upstream\\emscripten\\cache\\sysroot\\lib\\wasm32-emscripten\libGL-mt-emu-getprocaddr.a(webgl1.o)
em++: error: 'D:/_conan/p/b/emsdkbd647c4c78dd5/p/bin/upstream/bin\wasm-ld.exe @C:\Users\Martin\AppData\Local\Temp\emscripten_qx5196_8.rsp.utf-8' failed (returned 1)
ninja: build stopped: subcommand failed.
sbc100 commented 3 weeks ago

In theory it should not be possible to link against both libGL.a and libGL-mt-emu-getprocaddr.a since they are two flavors of the same library.

I can't seem to reproduce this error myself but I also cannot see all the compile flags used since some of them seem to be in @CMakeFiles\wasm2.rsp. Can you share the contents of that file maybe?