How to compile llvm with mingw on Windows ?

I'm trying to compile llvm (cvs head) on windows (WinXP sp2) using the lastest mingw, but I'm getting the link errors found below. It seems that the tools are not being linked with win32 api lib (libimagehlp.a and libpsapi.a) which defines the missing symbols. The TOOLS_VERBOSE link command is at the end of the mail and does not contain those libraries.

The configure line I'm using is:
../configure --enable-optimized --enable-jit --enable-targets="host-only" --prefix=/e/prg/vc/llvm-cvs-mingw/dist/ --with-tclinclude=/d/wut/prg/mingw/bin/

Is there anything to add to link against the missing libraries (I'm not familiar with the mingw platform)...

Baptiste.

llvm[2]: Linking Release executable tblgen (without symbols)
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Signals.o)(.text+0x4d4):Signals.cpp: undefined reference to `_imp__SymSetOptions@4'
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Signals.o)(.text+0x4f3):Signals.cpp: undefined reference to `_imp__SymInitialize@12'
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Signals.o)(.text+0x4fc):Signals.cpp: undefined reference to `_imp__SymGetModuleBase@8'
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Signals.o)(.text+0x50a):Signals.cpp: undefined reference to `_imp__SymFunctionTableAccess@8'
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Signals.o)(.text+0x542):Signals.cpp: undefined reference to `_imp__StackWalk@36'
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Signals.o)(.text+0x5fe):Signals.cpp: undefined reference to `_imp__SymGetModuleBase@8'
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Signals.o)(.text+0x6f5):Signals.cpp: undefined reference to `_imp__SymGetSymFromAddr@16'
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Signals.o)(.text+0x79b):Signals.cpp: undefined reference to `_imp__SymGetLineFromAddr@16'
collect2: ld returned 1 exit status

llvm[2]: Linking Release executable fpcmp (without symbols)
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Process.o)(.text+0x8d):Process.cpp: undefined reference to `GetProcessMemoryInfo@12'
collect2: ld returned 1 exit status

* make TOOLS_VERBOSE=1 output:
g++ -I/e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/utils/fpcmp -I/e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/../utils/fpcmp -I/e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/include -I/e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/../include -I/e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/include -I/e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/../include -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -Wall -W -Wwrite-strings -Wno-unused -O3 -DNDEBUG -v -o /e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/bin/fpcmp.exe /e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/utils/fpcmp/Release/fpcmp.o -Wl,--export-dynamic -L/e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib -lLLVMSupport -lLLVMSystem -L/e/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/bin
Reading specs from d:/wut/prg/mingw/bin/../lib/gcc/mingw32/3.4.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)
d:/wut/prg/mingw/bin/../libexec/gcc/mingw32/3.4.2/collect2.exe -Bdynamic -o e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/bin/fpcmp.exe d:/wut/prg/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../crt2.o d:/wut/prg/mingw/bin/../lib/gcc/mingw32/3.4.2/crtbegin.o -Le:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib -Le:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/bin -Ld:/wut/prg/mingw/bin/../lib/gcc/mingw32/3.4.2 -Ld:/wut/prg/mingw/bin/../lib/gcc -Ld:/wut/prg/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../../mingw32/lib -Ld:/wut/prg/mingw/bin/../lib/gcc/mingw32/3.4.2/../../.. e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/utils/fpcmp/Release/fpcmp.o --export-dynamic -lLLVMSupport -lLLVMSystem -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt d:/wut/prg/mingw/bin/../lib/gcc/mingw32/3.4.2/crtend.o
e:/prg/vc/llvm-cvs-mingw/llvm/mingw-obj/Release/lib/libLLVMSystem.a(Process.o)(.text+0x8d):Process.cpp: undefined reference to `GetProcessMemoryInfo@12'
collect2: ld returned 1 exit status

Hi,

Please have a look on my private Getting started with MinGW:

http://www.geocities.com/henrik_bach_llvm/

Henrik.