Issue compiling LLVM 2.6 on Windows with MinGW

Hello,

I downloaded LLVM 2.6 and was attempting to compile it with TDM-GCC 4.4.1-tdm2-sjlj + cmake 2.6.4 and this happened:

=============Console===================

C:\projects\game-editor\LLVM\build-root>mingw32-make
[ 2%] Built target LLVMSystem
[ 5%] Built target LLVMSupport
[ 7%] Built target tblgen
[ 7%] Built target intrinsics_gen
[ 10%] Built target LLVMCore
[ 12%] Built target LLVMTransformUtils
[ 15%] Built target LLVMScalarOpts
[ 22%] Built target LLVMCodeGen
[ 26%] Built target LLVMAnalysis
[ 26%] Built target LLVMAsmPrinter
[ 29%] Built target LLVMSelectionDAG
[ 30%] Built target LLVMBitReader
[ 31%] Built target LLVMBitWriter
[ 32%] Built target LLVMInstrumentation
[ 36%] Built target LLVMipo
[ 36%] Built target LLVMHello
[ 36%] Built target LLVMLinker
[ 36%] Built target LLVMipa
[ 38%] Built target LLVMMC
[ 38%] Built target FileCheck
[ 40%] Built target ARMCodeGenTable_gen
[ 44%] Built target LLVMARMCodeGen
[ 45%] Built target LLVMARMInfo
[ 45%] Built target LLVMARMAsmPrinter
[ 45%] Built target LLVMCBackend
[ 45%] Built target LLVMCBackendInfo
[ 45%] Built target LLVMCppBackend
[ 45%] Built target LLVMCppBackendInfo
[ 47%] Built target MipsCodeGenTable_gen
[ 50%] Built target LLVMMipsCodeGen
[ 50%] Built target LLVMMipsInfo
[ 50%] Built target LLVMMipsAsmPrinter
[ 50%] Built target LLVMMSIL
[ 50%] Built target LLVMMSILInfo
[ 52%] Built target PowerPCCodeGenTable_gen
[ 56%] Built target LLVMPowerPCCodeGen
[ 56%] Built target LLVMPowerPCInfo
[ 56%] Built target LLVMPowerPCAsmPrinter
[ 58%] Built target X86CodeGenTable_gen
[ 62%] Built target LLVMX86CodeGen
[ 63%] Built target LLVMX86Info
[ 63%] Built target LLVMX86AsmPrinter
[ 63%] Built target LLVMX86AsmParser
[ 63%] Built target LLVMExecutionEngine
[ 64%] Built target LLVMInterpreter
[ 64%] Built target LLVMJIT
[ 67%] Built target LLVMTarget
[ 67%] Built target LLVMAsmParser
[ 68%] Built target LLVMDebugger
[ 68%] Built target LLVMArchive
Linking CXX executable …\bin\opt.exe
…\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x25): undefined r
eference to _imp__pthread_rwlockattr_init' ..\..\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x5f): undefined r eference to _imp__pthread_rwlockattr_setpshared’
…\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x76): undefined r
eference to _imp__pthread_rwlock_init' ..\..\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0xa8): undefined r eference to _imp__pthread_rwlockattr_destroy’
…\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x103): undefined
reference to _imp__pthread_rwlockattr_init' ..\..\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x13d): undefined reference to _imp__pthread_rwlockattr_setpshared’
…\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x154): undefined
reference to _imp__pthread_rwlock_init' ..\..\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x186): undefined reference to _imp__pthread_rwlockattr_destroy’
…\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x1f3): undefined
reference to _imp__pthread_rwlock_destroy' ..\..\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x23d): undefined reference to _imp__pthread_rwlock_destroy’
…\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x287): undefined
reference to _imp__pthread_rwlock_rdlock' ..\..\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x2d1): undefined reference to _imp__pthread_rwlock_unlock’
…\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x31b): undefined
reference to _imp__pthread_rwlock_wrlock' ..\..\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x365): undefined reference to _imp__pthread_rwlock_unlock’
…\lib\libLLVMSystem.a(ThreadLocal.cpp.obj):ThreadLocal.cpp:(.text+0x37): und
efined reference to _imp__pthread_key_create' ..\..\lib\libLLVMSystem.a(ThreadLocal.cpp.obj):ThreadLocal.cpp:(.text+0xa5): und efined reference to _imp__pthread_key_create’
…\lib\libLLVMSystem.a(ThreadLocal.cpp.obj):ThreadLocal.cpp:(.text+0xfd): und
efined reference to _imp__pthread_key_delete' ..\..\lib\libLLVMSystem.a(ThreadLocal.cpp.obj):ThreadLocal.cpp:(.text+0x16b): un defined reference to _imp__pthread_key_delete’
…\lib\libLLVMSystem.a(ThreadLocal.cpp.obj):ThreadLocal.cpp:(.text+0x1d9): un
defined reference to _imp__pthread_key_delete' ..\..\lib\libLLVMSystem.a(ThreadLocal.cpp.obj):ThreadLocal.cpp:(.text+0x245): un defined reference to _imp__pthread_setspecific’
…\lib\libLLVMSystem.a(ThreadLocal.cpp.obj):ThreadLocal.cpp:(.text+0x28a): un
defined reference to `_imp__pthread_getspecific’
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/opt.exe] Error 1
mingw32-make[1]: *** [tools/opt/CMakeFiles/opt.dir/all] Error 2
mingw32-make: *** [all] Error 2

C:\projects\game-editor\LLVM\build-root>

=======End console===========

The pthread libraries are there, so what’s going on?

King InuYasha <ngompa13@gmail.com> writes:

I downloaded LLVM 2.6 and was attempting to compile it with TDM-GCC
4.4.1-tdm2-sjlj + cmake 2.6.4 and this happened:

[snip]

Linking CXX executable ..\..\bin\opt.exe
..\..\lib\libLLVMSystem.a(RWMutex.cpp.obj):RWMutex.cpp:(.text+0x25):
undefined reference to `_imp__pthread_rwlockattr_init'

[snip]

The pthread libraries are there, so what's going on?

For this issues, bug reports are more convenient than messages on the
mailing list, so please file a bug report and put my e-mail on its CC
list.

Please execute

mingw32-make VERBOSE=1

and show the link command for opt.exe