Boost logo

Boost-Build :

From: Michael Stevens (Michael.Stevens_at_[hidden])
Date: 2003-06-10 09:58:10


 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.

I have appended a suggested context diff against the CVS head of gcc.jam

All the best,
Michael Stevens

*** gcc.jam 2003-06-06 11:38:49.000000000 +0200
--- gcc-fixed.jam 2003-06-10 16:52:21.000000000 +0200
***************
*** 24,30 ****
# version binary-name [path]
# And specifies the name / path that should be used to invoke
# the specified gcc version. The default version will be always called
! # with 'g++'.
rule init ( a1 * : a2 * : a3 * )
{
if $(a1)
--- 24,30 ----
# version binary-name [path]
# And specifies the name / path that should be used to invoke
# the specified gcc version. The default version will be always called
! # with 'gcc'.
rule init ( a1 * : a2 * : a3 * )
{
if $(a1)
***************
*** 74,80 ****

actions compile
{
! $(NAME:E=g++) -Wall -ftemplate-depth-100 $(OPTIONS) -D$(DEFINES)
-I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

# Declare flags and action for linking
--- 74,80 ----

actions compile
{
! $(NAME:E=gcc) -Wall -ftemplate-depth-100 $(OPTIONS) -D$(DEFINES)
-I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

# Declare flags and action for linking
***************
*** 100,105 ****

actions link bind LIBRARIES
{
! $(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)"
-Wl,-rpath$(SPACE)-Wl,"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)"
-Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST)
"$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic
-l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME)
}

# Declare action for creating static libraries
--- 100,105 ----

actions link bind LIBRARIES
{
! $(NAME:E=gcc) -lstdc++ $(OPTIONS) -L"$(LINKPATH)"
-Wl,-rpath$(SPACE)-Wl,"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)"
-Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST)
"$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA) -Wl,-Bstatic
-l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME)
}

# Declare action for creating static libraries
***************
*** 128,132 ****

actions link-dll bind LIBRARIES
{
! $(NAME:E=g++) $(OPTIONS) -L"$(LINKPATH)"
-Wl,-rpath$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname,$(<[1]:D=)
-shared "$(>)" "$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA)
-Wl,-Bstatic -l$(FINDLIBS-ST) "$(LIBRARIES)" -Wl,-Bdynamic
-l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME)
}
--- 128,132 ----

actions link-dll bind LIBRARIES
{
! $(NAME:E=gcc) -lstdc++ $(OPTIONS) -L"$(LINKPATH)"
-Wl,-rpath$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-soname,$(<[1]:D=)
-shared "$(>)" "$(LIBRARIES)" -Wl,-Bdynamic -l$(FINDLIBS-SA)
-Wl,-Bstatic -l$(FINDLIBS-ST) "$(LIBRARIES)" -Wl,-Bdynamic
-l$(FINDLIBS-SA) -Wl,-Bstatic -l$(FINDLIBS-ST) -Wl,-B$(LINK-RUNTIME)
}

 


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