Mingw, cross-compiling,___eprintf

Cross-compiling from Ubuntu 8.04 x86_64 to mingw with the cmake
build system fails with this error while linking some tools:

../../lib/libLLVMSystem.a(DynamicLibrary.cpp.obj):DynamicLibrary.cpp:(.text+0x367):
undefined reference to `___eprintf'

___eprintf is mentioned in lib/System/Win32/DynamicLibrary.inc. This
symbol is referenced by libLLVMSystem.a when LLVM is natively built on
Windows/Mingw, but there the link succeeds.

So, is this a cross-compiler issue?

OTOH, the build complains about this:

/usr/lib/gcc/i586-mingw32msvc/4.2.1-sjlj/libstdc++.a(stubs.o):(.text+0x160):
multiple definition of `_powf'
../../lib/libLLVMCodeGen.a(RegAllocLinearScan.cpp.obj):RegAllocLinearScan.cpp:(.text$powf[_powf]+0x0):first defined here

Oh, and ld segfaults after spitting the errors:

collect2: ld terminated with signal 11 [Segmentation fault]

Hope someone who is used to cross-compile with MinGW can provide some
suggestion.

oscar@qcore:~/dev/llvm/mingw-x$ i586-mingw32msvc-g++ --version
i586-mingw32msvc-g++ (GCC) 4.2.1-sjlj (mingw32-2)

oscar@qcore:~/dev/llvm/mingw-x$ i586-mingw32msvc-ld --version
GNU ld version 2.17.50 20070129

Hello, Oscar

oscar@qcore:~/dev/llvm/mingw-x$ i586-mingw32msvc-g++ --version
i586-mingw32msvc-g++ (GCC) 4.2.1-sjlj (mingw32-2)

Have you tried to build llvm natively with exact same compiler
version? AFAIR, someone reported, that either this was not possible or
there was a miscompilation.

PS: Everything is with crosscompilation via gcc 3.4.6 & ld 2.18

Hello, Anton.

"Anton Korobeynikov" <anton@korobeynikov.info> writes:

oscar@qcore:~/dev/llvm/mingw-x$ i586-mingw32msvc-g++ --version
i586-mingw32msvc-g++ (GCC) 4.2.1-sjlj (mingw32-2)

Have you tried to build llvm natively with exact same compiler
version?

The native build works on WindowsXP MSYS 1.10.1 with gcc 4.2.1-dw2. Same
compiler version, but with Dwarf-2 exception handling instead of sjlj.

AFAIR, someone reported, that either this was not possible or
there was a miscompilation.

Thanks, I'll dig into the archives.

PS: Everything is with crosscompilation via gcc 3.4.6 & ld 2.18

Okay, then I'll finish the implementation and you will check that it
builds a complete LLVM for MinGW :slight_smile: