[llvm-dev] Error cross building LLVM for MinGW

Richard Pennington via llvm-dev
Wed, 17 Feb 2016 18:39:02 -0000

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