When building LLVM/Clang, I get the following build failure:<br><br>[ 4%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.obj<br>In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>
M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:48:17: error: redefinition of '_IMAGEHLP_LINE64'<br> typedef struct _IMAGEHLP_LINE64 {<br> ^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:475:18: note: previous definition is here<br>
typedef struct _IMAGEHLP_LINE64 {<br> ^<br>In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:56:17: error: redefinition of '_IMAGEHLP_SYMBOL64'<br>
typedef struct _IMAGEHLP_SYMBOL64 {<br> ^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:353:18: note: previous definition is here<br> typedef struct _IMAGEHLP_SYMBOL64 {<br>
^<br>In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:65:17: error: redefinition of '_tagADDRESS64'<br> typedef struct _tagADDRESS64 {<br>
^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:154:18: note: previous definition is here<br> typedef struct _tagADDRESS64 {<br> ^<br>
In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:71:17: error: redefinition of '_KDHELP64'<br> typedef struct _KDHELP64 {<br>
^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:183:18: note: previous definition is here<br> typedef struct _KDHELP64 {<br> ^<br>
In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:86:17: error: redefinition of '_tagSTACKFRAME64'<br> typedef struct _tagSTACKFRAME64 {<br>
^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:231:18: note: previous definition is here<br> typedef struct _tagSTACKFRAME64 {<br> ^<br>
In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:118:22: error: redefinition of 'StackWalk64' as different kind of symbol<br>
static fpStackWalk64 StackWalk64;<br> ^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:269:20: note: previous definition is here<br> WINBOOL IMAGEAPI StackWalk64(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME64 StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE64<br>
^<br>In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:121:29: error: redefinition of 'SymGetModuleBase64' as different kind of symbol<br>
static fpSymGetModuleBase64 SymGetModuleBase64;<br> ^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:728:20: note: previous definition is here<br>
DWORD64 IMAGEAPI SymGetModuleBase64(HANDLE hProcess,DWORD64 qwAddr);<br> ^<br>In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:125:30: error: redefinition of 'SymGetSymFromAddr64' as different kind of symbol<br>
static fpSymGetSymFromAddr64 SymGetSymFromAddr64;<br> ^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:1018:20: note: previous definition is here<br>
WINBOOL IMAGEAPI SymGetSymFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD64 pdwDisplacement,PIMAGEHLP_SYMBOL64 Symbol);<br> ^<br>In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>
M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:129:31: error: redefinition of 'SymGetLineFromAddr64' as different kind of symbol<br>static fpSymGetLineFromAddr64 SymGetLineFromAddr64;<br> ^<br>
M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:777:20: note: previous definition is here<br> WINBOOL IMAGEAPI SymGetLineFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE64 Line64);<br>
^<br>In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:132:35: error: redefinition of 'SymFunctionTableAccess64' as different kind of symbol<br>
static fpSymFunctionTableAccess64 SymFunctionTableAccess64;<br> ^<br>M:/Development/mingw64/bin/../lib/clang/3.0/../../../x86_64-w64-mingw32/include\psdk_inc/_dbg_common.h:709:18: note: previous definition is here<br>
PVOID IMAGEAPI SymFunctionTableAccess64(HANDLE hProcess,DWORD64 AddrBase);<br> ^<br>In file included from M:\Development\Source\LLVM\lib\Support\Signals.cpp:33:<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:137:17: error: non-object type 'WINBOOL (DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID, PREAD_PROCESS_MEMORY_ROUTINE64, PFUNCTION_TABLE_ACCESS_ROUTINE64, PGET_MODULE_BASE_ROUTINE64, PTRANSLATE_ADDRESS_ROUTINE64)' is not assignable<br>
StackWalk64 = (fpStackWalk64)<br> ~~~~~~~~~~~ ^<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:139:24: error: non-object type 'DWORD64 (HANDLE, DWORD64)' is not assignable<br> SymGetModuleBase64 = (fpSymGetModuleBase64)<br>
~~~~~~~~~~~~~~~~~~ ^<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:141:25: error: non-object type 'WINBOOL (HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64)' is not assignable<br> SymGetSymFromAddr64 = (fpSymGetSymFromAddr64)<br>
~~~~~~~~~~~~~~~~~~~ ^<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:143:26: error: non-object type 'WINBOOL (HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64)' is not assignable<br> SymGetLineFromAddr64 = (fpSymGetLineFromAddr64)<br>
~~~~~~~~~~~~~~~~~~~~ ^<br>M:\Development\Source\LLVM\lib\Support/Windows/Signals.inc:145:30: error: non-object type 'PVOID (HANDLE, DWORD64)' is not assignable<br> SymFunctionTableAccess64 = (fpSymFunctionTableAccess64)<br>
~~~~~~~~~~~~~~~~~~~~~~~~ ^<br>15 errors generated.<br>mingw32-make[2]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.obj] Error 1<br><br>MinGW-w64 provides the necessary typedefs and declarations. I adjusted the ifdef's to include a check for a the MinGW-w64-specific symbol of choice to differentiate <a href="http://mingw.org">mingw.org</a> vs mingw-w64. Tested on i686-w64-mingw32 and x86_64-w64-mingw32.<br>
<br>Please comment or apply. (I am not subscribed to llvm-dev, sorry :-/)<br><br>Ruben<br>