When I try to build llvm on windows/mingw32, I get the following error:
In file included from c:/work/mingw/src/llvm/lib/System/Signals.cpp:33:
c:/work/mingw/src/llvm/lib/System/Win32/Signals.inc: In function 'LONG LLVMUnhandledExceptionFilter(_EXCEPTION_POINTERS*)':
c:/work/mingw/src/llvm/lib/System/Win32/Signals.inc:275: error: exception handling disabled, use -fexceptions to enable
make[1]: *** [/c/work/mingw/src/build.llvm/lib/System/Release/Signals.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/c/work/mingw/src/build.llvm/lib/System'
Wow, I also meet this error before, I'll be pleasure if anyone can
solve this problem, and by the way, are you using msys as the building
env? It's seems that mingw/cmake is working but mingw/msys, and I
didn't ever try with mingw/cygwin:) thanks.
You'll better investigate why exception support is required for MSYS
while all other configure-based builds work fine without it.
Surely it's required for any system that uses
lib/System/Win32/Signals.inc, because there's code in that file that
uses try/catch.
MingW is the only system I know of that uses that file; Cygwin
pretends to be Unix-like, so it uses lib/System/Unix/Signals.inc
instead. So I'd suggest the attached (untested) patch.
GetProcessMemoryInfo should be defined in psapi.lib, but AFAICS mingw32
doesn't have this import lib. It is included in the MS Platform SDK,
but I'm not sure whether you can link that into mingw32 programs...
My apologies, I was mistaken, as Yonggang pointed out to me privately;
mingw32 does come with a libpsapi.lib file, but in your case it does not
get added to the libs to be linked with, apparently.
In my case, the configure script does check for the existence of
libpsapi.a, and adds both a HAVE_LIBPSAPI define to config.h, and
-lpsapi to LIBS.
Can you find anything in your config.log file about libpsapi?
>>> d:/objs/llvm/msys/Debug/lib/libLLVMSystem.a(Process.o):e:/Downloads/llvm-trunk/lib/System/Win32/Process.inc:78:
>>> undefined reference to `GetProcessMemoryInfo@12'
>> GetProcessMemoryInfo should be defined in psapi.lib, but AFAICS mingw32
>> doesn't have this import lib. It is included in the MS Platform SDK,
>> but I'm not sure whether you can link that into mingw32 programs...
> msdn suggests kernel32, but that is already included.
My apologies, I was mistaken, as Yonggang pointed out to me privately;
mingw32 does come with a libpsapi.lib file, but in your case it does not
get added to the libs to be linked with, apparently.
In my case, the configure script does check for the existence of
libpsapi.a, and adds both a HAVE_LIBPSAPI define to config.h, and
-lpsapi to LIBS.
Can you find anything in your config.log file about libpsapi?
> >>> d:/objs/llvm/msys/Debug/lib/libLLVMSystem.a(Process.o):e:/Downloads/llvm-trunk/lib/System/Win32/Process.inc:78:
> >>> undefined reference to `GetProcessMemoryInfo@12'
> >> GetProcessMemoryInfo should be defined in psapi.lib, but AFAICS mingw32
> >> doesn't have this import lib. It is included in the MS Platform SDK,
> >> but I'm not sure whether you can link that into mingw32 programs...
> > msdn suggests kernel32, but that is already included.
>
> My apologies, I was mistaken, as Yonggang pointed out to me privately;
> mingw32 does come with a libpsapi.lib file, but in your case it does not
> get added to the libs to be linked with, apparently.
>
> In my case, the configure script does check for the existence of
> libpsapi.a, and adds both a HAVE_LIBPSAPI define to config.h, and
> -lpsapi to LIBS.
>
> Can you find anything in your config.log file about libpsapi?
#define HAVE_LIBPSAPI 1
in config.h
I had a close look at the link line, and -lpsapi is specified before -lLLVMSystem (which is giving the error).
When I put -lpsapi after -lLLVMSystem, it links ok.
it links okay. I have tested a similar fix as r83252, which I saw you
just committed, and that seems to work. At least, it's far into the
examples directory by now, without problems...