Richard Pennington via llvm-dev
2016-Feb-18 23:39 UTC
[llvm-dev] Error cross building LLVM for MinGW
On 02/17/2016 07:23 PM, Tony Kelman via llvm-dev wrote:> Richard Pennington via llvm-dev <llvm-dev <at> lists.llvm.org> writes: > >> I use ELLCC to cross compile all the tools for various Linux targets and >> for Windows. Yesterday, after updating the LLVM sources, I got the >> following error when cross building for MinGW: > I haven't seen this exact error (I build in a similar configuration), > but I don't check trunk every day so it sounds new. Worth bisecting? > Is there an easy binary installation method to replicate your mingw-cross > compiler configuration? I have some cross-build docker containers where > I'll try to reproduce with the versions of mingw that I've been using. > > -Tony >Hi Tony, I googled around a little bit and found this bug: https://llvm.org/bugs/show_bug.cgi?id=9744 The generated code is somewhat different, but the little test case fails for me in exactly the same way: [~] dev% cat test.cpp #include <stdio.h> #include <string> using std::string; int main() { string a(" test"); a = "a" + a; printf("%s\n", a.c_str()); return 0; } [~] dev% ~/ellcc/bin/ecc++ -target x86_64-w64-mingw32 test.cpp /home/rich/ellcc/bin/../libecc/mingw/x86_64-w64-mingw32/sys-root/mingw/lib/libstdc++.a(string-inst.o): In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /builddir/build/BUILD/gcc-4.9.2/build_win64/x86_64-w64-mingw32/libstdc++-v3/include/bits/basic_string.tcc:692: multiple definition of `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/test-1e978b.o:(.text[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_RKS6_]+0x0): first defined here clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation) [~] dev% Strange. -Rich
Tony Kelman via llvm-dev
2016-Feb-19 05:51 UTC
[llvm-dev] Error cross building LLVM for MinGW
Richard Pennington via llvm-dev <llvm-dev <at> lists.llvm.org> writes:> Hi Tony, > > I googled around a little bit and found this bug: > https://llvm.org/bugs/show_bug.cgi?id=9744 > The generated code is somewhat different, but the little test case fails > for me in exactly the same way:I can reproduce actually. Does your ecc++ driver default to trying to link libstdc++ statically? Using the kinda-old x86_64-w64-mingw32-clang++ 3.5.1 that was recently added to Cygwin I get the same, but only when I try to build with -static-libstdc++. (-fno-exceptions wouldn't be needed with a more recent clang, I think) $ x86_64-w64-mingw32-clang++ -fno-exceptions -static-libstdc++ test.cpp /usr/lib/gcc/x86_64-w64-mingw32/4.9.2/libstdc++.a(string-inst.o): In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /usr/src/debug/mingw64-x86_64-gcc-4.9.2-2/x86_64-w64-mingw32/libstdc++-v3/ include/bits/basic_string.tcc:692: multiple definition of `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /tmp/test-7b9696.o:(.text[_ZStplIcSt11char_traitsIcESaIcEESbIT_ T0_T1_EPKS3_RKS6_]+0x0): first defined here collect2: error: ld returned 1 exit status x86_64-w64-mingw32-clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
Richard Pennington via llvm-dev
2016-Feb-19 18:42 UTC
[llvm-dev] Error cross building LLVM for MinGW
On 02/18/2016 11:51 PM, Tony Kelman via llvm-dev wrote:> > I can reproduce actually. Does your ecc++ driver default to trying to > link libstdc++ statically? Using the kinda-old x86_64-w64-mingw32-clang++ > 3.5.1 that was recently added to Cygwin I get the same, but only when I > try to build with -static-libstdc++. (-fno-exceptions wouldn't be needed > with a more recent clang, I think) > > $ x86_64-w64-mingw32-clang++ -fno-exceptions -static-libstdc++ test.cpp >Yes, I link statically so I don't have to send DLLs. -Rich