https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110572
Bug ID: 110572 Summary: ld.lld: error: duplicate symbol: std::type_info::operator==(std::type_info const&) const Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: arndtthomas at gmx dot de Target Milestone: --- Created attachment 55489 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55489&action=edit example to reproduce the error I've filed the issue since it's a problem with libstdc++/tinfo.o. It seems there is a missing inline if macro __GXX_TYPEINFO_EQUALITY_INLINE is unset or set to 1. It happens if clang is used under mingw-w64 in combination with the libstdc++ (msys2 default). Since gcc defines the macro explicitly (built-in) to _GXX_TYPEINFO_EQUALITY_INLINE=0 (see gcc/config/i386/cygming.h). Clang doesn't define this macro at all, so it gets defined within typeinfo while compiling user code. Thus there are one operator== defined within tinfo.o and another within the user archive. During linking the following error pops up: ld.lld: error: duplicate symbol: std::type_info::operator==(std::type_info const&) const >>> defined at ../../../../libstdc++-v3/libsupc++/tinfo.cc:38 >>> libstdc++.a(tinfo.o) >>> defined at libclang_lld_error.a(comp_unit.o) clang++: error: linker command failed with exit code 1 (use -v to see invocation) Here is the full example to reproduce: https://github.com/msys2/MINGW-packages/issues/17730 I fully agree, it's a issue which is more related to mingw-w64 and clang but the root cause is unfortunately the libstdc++.