From c776239c3c685cf14b46b27d3fa2a2d7ac508349 Mon Sep 17 00:00:00 2001 From: krcroft Date: Sun, 5 Jan 2020 19:41:05 -0800 Subject: [PATCH] Switch from static to dynamically-linked libstdc++ When using C++11 code that can possibly throw exceptions (such as std::make_shared(...) linking libstdc++.a using Clang on MSYS2 will generate errors such as: libstdc++.a(eh_personality.o): duplicate section `.rdata$_ZTSSt9exception[_ZTSSt9exception]' has different size Although potential suggested fixes involve allowing duplicate symbols, -Wl,--allow-multiple-definition, this solution can introduce unexpected behavior when one symbol clobbers another symbol. To solve this, switching to dynamic linking of the libstdc++ library appears to be all that's needed. --- scripts/automator/build/clang-msys_nt_x86_64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/automator/build/clang-msys_nt_x86_64 b/scripts/automator/build/clang-msys_nt_x86_64 index aed20fc7..7dfc42d2 100644 --- a/scripts/automator/build/clang-msys_nt_x86_64 +++ b/scripts/automator/build/clang-msys_nt_x86_64 @@ -2,4 +2,4 @@ ar="llvm-ar${postfix}" ld="llvm-link${postfix}" ranlib="llvm-ranlib${postfix}" -ldflags+=(-static-libgcc -static-libstdc++) +ldflags+=(-static-libgcc)