Subject: Re: [Boost-build] gcc precompiled headers
From: Vladimir Prus (ghost_at_[hidden])
Date: 2008-11-16 13:00:15
On Sunday 16 November 2008 20:25:35 Jeroen van der Wulp wrote:
> Hello everyone,
> I'm still looking at precompiled headers and I found another small
> issue. At some point it all seemed to work but today I found that the
> names of precompiled headers should be of the form x.hpp.gch for a
> header file x.hpp. With the Boost trunk version of Boost Build I am
> getting x.gch which I thought to be okay for some time.
> The comment in gcc.jam suggests that it was once working this way:
> # Calls the base version specifying source's name as the name of the created
> # target. As result, the PCH will be named whatever.hpp.gch, and not
> # whatever.gch.
> rule generated-targets ( sources + : property-set : project name ? )
> I prepared a small patch that solved the problem for me. Although it
> solves the problem it feels like a hack. Maybe someone more knowledgable
> can have a quick look.
This is recent breakage from the 'make source files with same name
in different directories work' patch. I've checked in a fix:
> Another problem I'm having is that I'm importing precompiled headers in
> library sources files as well as source files for executables. The
> differences between the two in my case are the setting of the -fPIC
> flag. The precompiled header cannot be used by both.
Are either libraries or executables static? Because when link=static, which
is the default, -fPIC is added everywhere.
> Can I also solve this problem by setting -fpic for all compilations in
> the project? For what platforms/gcc versions can this work and does this
> have any unwanted side-effects?
-fPIC will work everywhere. It has some performance penalty, though I'm not
sure anybody considers it significant nowdays.
> On the other hand I was wondering
> whether an position independent code feature might help with this.
Suggestion for 'shared-linkable' feature was raised some time ago; I'm don't
have a strong opinion either way.
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk