views:

932

answers:

4

I'm using Code::Blocks IDE with Gcc/minGW on Windows and I'm trying to build a wxWidgets application which has ca. 20k lines and 40 source modules. And it builds very very slow. Compiling a cpp module lasts 2-5 seconds, and linking lasts even 2-3 minutes.

It's a portable code, this code on Linux compiles very fast. I can't follow the build message window... The entire process lasts less than 20 seconds.

I tried the common tweaks (eg. precompiled header, turn optimalizations off, etc) but nothing worked.

Why is it so slow?

Any ideas?

+2  A: 

it says : That's a known issue with MinGW. I'm not sure what the reasons are, but compiling and linking with MinGW is painfully slow.

Adinochestva
that link is nearly 5 years old. I haven't noticed any major compilation speed problems with the gcc 4.4.0 verion I'm using - linking could still be faster, but it's not impossibly slow
anon
That's also a QT specific point.
Billy ONeal
According to the last post in the thread by Kuba Ober, the problem is, "the gratuitous inefficiencies in ld/pe-dll.c in mingw's binutils tree. Namely that it allocates a bazillion heap items only to free them in a millisecond. There are other bad things there too. That file is the main culprit as far as I recall". Maybe those are fixed in GCC 4.x distributions?
Michael Burr
A: 

MinGW linking is still impossibly slow.

I recently took the time to port a huge application with nearly a million lines of code from the (ack) Borland compiler suite to GNU. It works, but compile time is about 15% slower and linking takes easily ten times longer than with Borland. With linking, something that takes 3 minutes with Borland takes 15 minutes with GNU.

There is no help anywhere online for this issue, so we are going to have to find another build system.

James Baker
A: 

Are you on an Active Directory domain, but not immediately connected to it?

While I don't have the "answer" as to why MinGW would be slow, it has been my experience that computers which belong to an AD domain, but are unable to reach the AD controller, have a delay in starting executables (such as rxvt.exe) and currently running ones experience a pause or stutter (such as emacs, which is built using MinGW).

I am still investigating to determine the actual cause of this behavior, but thought I would mention it in case it applies to you.

Matthew Daniel
A: 

You can try to use a more recent version of the toolset. I found this to be useful: http://nuwen.net/mingw.html It has all the tools used by MinGW and common APIs in a single big package.

SurvivalMachine