Open
Description
I tried: linking the GStreamer Rust plugins gstaws
and gstrswebrtc
, both built statically.
I expected to see this happen: linking success
Instead, this happened: some 5k lines of function clashes from shared dependencies e.g.:
libgstrswebrtc.a(gstrswebrtc.h2-9527afd107b48849.h2.4898c1e7831a741c-cgu.0.rcgu.o.rcgu.o) : error LNK2005: ya se definió _ZN102_$LT$core..iter..adapters..map..Map$LT$I$C$F$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$4fold17h30be9aebf26ab811E en libgstaws.a(gstaws.h2-9527afd107b48849.h2.4898c1e7831a741c-cgu.0.rcgu.o.rcgu.o)
libgstrswebrtc.a(gstrswebrtc.h2-9527afd107b48849.h2.4898c1e7831a741c-cgu.0.rcgu.o.rcgu.o) : error LNK2005: ya se definió _ZN111_$LT$core..iter..adapters..zip..Zip$LT$A$C$B$GT$$u20$as$u20$core..iter..adapters..zip..ZipImpl$LT$A$C$B$GT$$GT$3new17h21a4a1e578e1b030E en libgstaws.a(gstaws.h2-9527afd107b48849.h2.4898c1e7831a741c-cgu.0.rcgu.o.rcgu.o)
I believe this is caused by LLVM assuming IMAGE_COMDAT_SELECT_NODUPLICATES
for all function COMDATS, which is too restrictive for MSVC: https://github.com/llvm/llvm-project/blob/llvmorg-20.1.5/llvm/lib/Transforms/Utils/Instrumentation.cpp#L102-L107.
This should perhaps be changed to IMAGE_COMDAT_SELECT_EXACT_MATCH
on the Rust side; I tried it locally, but I got an impossibly long panic stacktrace which I attach below.
Meta
rustc --version --verbose
:
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-pc-windows-msvc
release: 1.87.0
LLVM version: 20.1.1
Backtrace: rustc-ice-2025-07-14T01_44_18-10920.txt