[llvm-dev] Error cross building LLVM for MinGW

Richard Pennington via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 18 15:39:23 PST 2016


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


More information about the llvm-dev mailing list