Richard Pennington via llvm-dev
2016-Feb-17 18:39 UTC
[llvm-dev] Error cross building LLVM for MinGW
Hi, I recently switched over to using cmake to build my clang/LLVM based ELLCC cross development project (http://ellcc.org). I also recently updated to LLVM svn version 258915 from 258477. 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: [ 3%] Built target LLVMSupport [ 3%] Built target LLVMTableGen [ 4%] Built target obj.llvm-tblgen [ 4%] Linking CXX executable ../../bin/llvm-tblgen /home/rich/ellcc-release/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&)' CMakeFiles/obj.llvm-tblgen.dir/AsmMatcherEmitter.cpp.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) utils/TableGen/CMakeFiles/llvm-tblgen.dir/build.make:135: recipe for target 'bin/llvm-tblgen' failed make[2]: *** [bin/llvm-tblgen] Error 1 CMakeFiles/Makefile2:383: recipe for target 'utils/TableGen/CMakeFiles/llvm-tblgen.dir/all' failed make[1]: *** [utils/TableGen/CMakeFiles/llvm-tblgen.dir/all] Error 2 Makefile:149: recipe for target 'all' failed make: *** [all] Error 2 Does anyone have any idea what I might have done to cause this? -Rich
Tony Kelman via llvm-dev
2016-Feb-18 01:23 UTC
[llvm-dev] Error cross building LLVM for MinGW
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
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