Boost logo

Boost-Build :

From: Rene Rivera (grafik666_at_[hidden])
Date: 2003-06-10 10:21:14


[2003-06-10] Michael Stevens wrote:

> Dear All,
>
>I have been doing some further testing of the current and M3 Boost.build
>v2 and have a few minor contributions. First of a minor bug and fix for
>the gcc toolset.
>
>Bug:
> gcc.jam defaults to using 'g++' for building source files. This
>incorrect for C sources files (.c), as 'g++' will assume they contain
>C++ no matter what the extension.
>
>Fix:
> Always use 'gcc' for building source files. This change interacts
>with the mechanism for setting $(NAME) when a gcc version is specified.
>For consistency I suggest that 'gcc' should always be used both in the
>default case and for named version. This change requires that C++
>library be explictly specified for linking.
> g++ does not specify the exact mechanism it uses to specify "linking
>agaist the C++ library". Therefore I have simply placed "-lstdc++" at
>the head of the command line.

No, the correct solution is to use "gcc" for compiling C files, "g++" for
compiling CPP files, and "g++" for linking always. The stdc++ is not the
only thing needed to make the linking work for CPP.

This would involve registering diferent actions for C and CPP compiles:

generators.register-c-compiler gcc.compile-cpp : CPP : OBJ : <toolset>gcc ;
generators.register-c-compiler gcc.compile-c : C : OBJ : <toolset>gcc ;

[with additional changes to create those actions]

But what surprises me when looking at the toolset is that this isn't already
there. Didn't we learn anything from the toolsets in BBv1? Or did I miss a
to-be-implemented item?

-- grafik - Don't Assume Anything
-- rrivera_at_[hidden] - grafik_at_[hidden]
-- 102708583_at_icq

 


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