Compiling LLVM on MinGW

I'm trying to compile the top version of LLVM with MinGW, but I'm
getting compilation errors.
They seem to be caused by the changes in rev 66072. Has anyone
compiled on MinGW?
Since I just installed MinGW on this computer it could be my problem.

(I noticed that LLVM 2.5 still doesn't come with binaries for the
libraries on MinGW.)

  -- Lennarft

What kind of errors?

Ciao,

Duncan.

Like this:

llvm[1]: Compiling Signals.cpp for Debug build
In file included from Signals.cpp:33:
Win32/Signals.inc:262: error: `sys' has not been declared
Win32/Signals.inc: In function `void AddSignalHandler(void (*)(void*), void*)':
Win32/Signals.inc:266: error: `KillSigs' was not declared in this scope
Win32/Signals.inc:266: error: `KillSigsEnd' was not declared in this scope
Win32/Signals.inc:266: error: `RegisterHandler' was not declared in this scope
Win32/Signals.inc:266: warning: unused variable 'KillSigs'
Win32/Signals.inc:266: warning: unused variable 'KillSigsEnd'
Win32/Signals.inc:266: warning: unused variable 'RegisterHandler'
make[1]: *** [/Desktop/Workspace/llvm/llvm-top/lib/System/Debug/Signals.o]
Error 1
make[1]: Leaving directory `/Desktop/Workspace/llvm/llvm-top/lib/System'

The void sys::AddSignalHandler() is outside the llvm namespace, which
seems wrong.
Moving it inside removes the first errors, but still leave KillSigs,
KillSigsEnd, and RegisterHandler undefined.

If I didn't know better I'd think someone had committed code without
compiling first. :slight_smile:

  -- Lennart

Like this:

llvm[1]: Compiling Signals.cpp for Debug build
In file included from Signals.cpp:33:
Win32/Signals.inc:262: error: `sys' has not been declared
Win32/Signals.inc: In function `void AddSignalHandler(void (*)(void*), void*)':
Win32/Signals.inc:266: error: `KillSigs' was not declared in this scope
Win32/Signals.inc:266: error: `KillSigsEnd' was not declared in this scope
Win32/Signals.inc:266: error: `RegisterHandler' was not declared in this scope
Win32/Signals.inc:266: warning: unused variable 'KillSigs'
Win32/Signals.inc:266: warning: unused variable 'KillSigsEnd'
Win32/Signals.inc:266: warning: unused variable 'RegisterHandler'
make[1]: *** [/Desktop/Workspace/llvm/llvm-top/lib/System/Debug/Signals.o]
Error 1
make[1]: Leaving directory `/Desktop/Workspace/llvm/llvm-top/lib/System'

The void sys::AddSignalHandler() is outside the llvm namespace, which
seems wrong.
Moving it inside removes the first errors, but still leave KillSigs,
KillSigsEnd, and RegisterHandler undefined.

Please try r66386.

If I didn't know better I'd think someone had committed code without
compiling first. :slight_smile:

I don't have a windows box to test on, I requested windows people to verify that it works when I committed the change, and there are no windows nightly testers or build bots. This is the first I have heard of the breakage.

-Chris

I know, it's a pain to develop for multiple platforms.

Anyway, r66388 works better. It compiles for quite a while, and then
dies linking Hello:

make[3]: Entering directory
`/Desktop/Workspace/llvm/llvm-top/lib/Transforms/Hello'
llvm[3]: Compiling Hello.cpp for Debug build (PIC)
llvm[3]: Linking Debug Loadable Module LLVMHello.dll
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/Transforms/Hello/Debug/Hello.o:
In function `ZN38_GLOBAL__N_Hello.cpp_F9DFF42A_546C77106Hello2D1Ev':
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/Transforms/Hello/Hello.cpp:(.text$_ZN4llvm8PassInfoC2EPKcS2_iPFPNS_4PassEvEbb[llvm::PassInfo::PassInfo(char
const*, char const*, int, llvm::Pass* (*)(), bool, bool)]+0x82):
undefined reference to `llvm::PassInfo::registerPass()'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/Transforms/Hello/Hello.cpp:(.text$_ZN4llvm12FunctionPassC2EPKv[llvm::FunctionPass::FunctionPass(void
const*)]+0x1d): undefined reference to `vtable for llvm::FunctionPass'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/Transforms/Hello/Hello.cpp:(.text$_ZN4llvm4PassC2EPKv[llvm::Pass::Pass(void
const*)]+0xb): undefined reference to `vtable for llvm::Pass'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/Transforms/Hello/Hello.cpp:(.rdata$_ZTVN38_GLOBAL__N_Hello.cpp_F9DFF42A_546C77106Hello2E[vtable
for (anonymous namespace)::Hello2]+0x10): undefined reference to
`llvm::Pass::getPassName() const'

followed by many more undefined references. Note that even when
compiling LLVM 2.5 I had warnings when linking Hello, because of
undefined references.

  -- Lennart

Commenting out the Hello transformation I get these link errors:

llvm[2]: Linking Debug Shared Library LTO.dll
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/Debug/lib/libLLVMSystem.a(Signals.o):
In function `Z28LLVMUnhandledExceptionFilterP19_EXCEPTION_POINTERS':
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:164:
undefined reference to `_imp__SymSetOptions@4'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:165:
undefined reference to `_imp__SymInitialize@12'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:168:
undefined reference to `_imp__SymGetModuleBase@8'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:168:
undefined reference to `_imp__SymFunctionTableAccess@8'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:168:
undefined reference to `_imp__StackWalk@36'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:186:
undefined reference to `_imp__SymGetModuleBase@8'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:199:
undefined reference to `_imp__SymGetSymFromAddr@16'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:214:
undefined reference to `_imp__SymGetLineFromAddr@16'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/Debug/lib/libLLVMSystem.a(Process.o):
In function `ZN4llvm3sys7Process19GetTotalMemoryUsageEv':
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Process.inc:78:
undefined reference to `GetProcessMemoryInfo@12'
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/Debug/lib/libLLVMSystem.a(DynamicLibrary.o):
In function `ZN4llvm3sys14DynamicLibrary22LoadLibraryPermanentlyEPKcPSs':
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/DynamicLibrary.inc:116:
undefined reference to `_imp__EnumerateLoadedModules@12'

  -- Lennart

Lennart Augustsson <lennart@augustsson.net> writes:

Commenting out the Hello transformation I get these link errors:

llvm[2]: Linking Debug Shared Library LTO.dll
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/Debug/lib/libLLVMSystem.a(Signals.o):
In function `Z28LLVMUnhandledExceptionFilterP19_EXCEPTION_POINTERS':
c:/DOCUME~1/1312888/Desktop/Workspace/llvm/llvm-top/lib/System/Win32/Signals.inc:164:
undefined reference to `_imp__SymSetOptions@4'

It seems that dbghelp.lib is required for building this.

Which build generator system are you using? cmake or configure?

[snip]

I'm using configure.

Just disable both libhello & liblto - they won't be usable on windows at all.

I'll take care on mingw build pretty soon.