precompiled headers with g++

Status
Not open for further replies.

echu888

Ars Tribunus Militum
1,667
the usefullness of them is questionable also
From what I know, pre-compiled headers are useful for compiling large projects faster. And it has no negative effect on the binary sizes? The downside being the rigid header structure that has to be maintained. Is that correct?

There is some work being done to add precompiled headers to GCC 3.x, but I don't know when it will become part of the official tree.
So the answer is no, gcc/g++ does not have pre-compiled header support as of now, and definently not in gcc 2.x. Right?
 
From what I know, pre-compiled headers are useful for compiling large projects faster. And it has no negative effect on the binary sizes? The downside being the rigid header structure that has to be maintained. Is that correct?
It's mostly correct. The one big downside is that with implementations like Microsoft's (eg. include "stdafx.h") you loose track of your dependencies. You just "include it all" and hope what you need is in there. Develop a large project like that for a few years, and then try to pull a module out of it... you'll be in hell. Most implementations end up having a similar problem because you need to have a fixed set of includes for the precompiled header idea to be useful.

Another downside is that a minor change to a header that's in the precompiled monster causes recompilation of the whole project. That's two good reasons to ditch precompiled headers. That, and processing power that's getting ever cheaper.

The only place I could see them being useful is within the open-source community where distribution-by-source is common and lots of people compile just to get binaries. Having a tool that can generate precompiled headers for those releases without breaking anything could be nice. But I repeat: precompiled headers are not good for developers.
 

dockeen

Ars Tribunus Militum
1,600
Hmmmm, I thought it was a rule we were supposed to let compiles run overnight!!!

Or let them run while we went for a cup of coffee and a short conversation about the realtionship between unfied field theory and global politics, come back, see something screwed up in the compile, fix it, restart, go play some golf....

Seriously though, I haven't done this, so I fell free to ask a dumb question, is this a trade between compilation speed and later flexability / maintainability of the code?

Wayne
 

Matty

Ars Scholae Palatinae
649
Hmmmm, I thought it was a rule we were supposed to let compiles run overnight!!!

But what happens when your nigtly builds start taking more than 24 hours?

I'm working on a project at the moment that takes over 6 hours for the nightly build and package (into RPMs). Addmitedly this is on one of our slower targets. I could easily see this blowing out in the future as gcc gets slower and our code gets bigger.

Another team has to (occasionally) rebuild the whole linux userland when the tool chain changes significantly, and this definately takes more than 24 hours.

Moral of the story: gcc is slow as hell. Get fast x86 hardware and cross compile.

Matty

P.S. Anyone know how long OpenOffice or Mozilla or KDE take to build these days?
 
Status
Not open for further replies.