Vittorio Romeo
Vittorio Romeo

Reputation: 93264

Clang slow startup (using MinGW)

Using MinGW and CMake I've compiled LLVM, Clang and Compiler-RT both via SVN or using the released source code (3.2).

I've modified InitHeaderSearch.cpp (in tools/clang/lib/frontend) to find GCC 4.7.2 headers.

I've set the compile options to Release and disabled assertions.

Clang seems to work properly, but it takes 4-5 seconds to start: even typing "clang --version" in the console does this. Compiling a projects takes a lot of time.

What am I missing? I've used rubenvb's old MinGW+Clang build (GCC 4.6), and it didn't have this problem. Is there any compilation flag I need to use?

Upvotes: 3

Views: 1166

Answers (1)

karbi79
karbi79

Reputation: 109

This issue is discussed here http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-April/020651.html

AFAIK problem is caused by large relocation table and inefficient MinGW implementation (http://sourceforge.net/p/mingw/bugs/1747/).

Adding -static flag to linker flags should resolve this issue. You should invoke cmake with

-DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_MODULE_LINKER_FLAGS=-static

Upvotes: 2

Related Questions