Boost logo

Boost :

Subject: [boost] [build] is triply broken on MinGW
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2013-07-18 05:14:02


For over a year I've been suffering from being broken on MinGW,
although I figured out a horrible hackaround. In 1.54.0 two more breaks
appeared, and I figured out real fixes for them. I'd like to offer my real
fixes here, and request two things: (A) a real fix to replace my horrible
hackaround for the original bug, and (B) to be tested on MinGW
for each release, because it's clearly not receiving sufficient coverage.

The first break appears to be tracked by and . The problem is that and b2.exe don't agree on what MinGW should be called: is it
mingw or is it gcc? No permutations of toolsets passed on the command lines
work. I've used the following horrible hackaround in 1.49.0 through 1.54.0

diff -aurN boost_1_54_0/ boost_1_54_0-fixed/
--- boost_1_54_0/ 2013-03-09 14:55:05 -0800
+++ boost_1_54_0-fixed/ 2013-07-18 00:12:38 -0700
@@ -215,7 +215,7 @@
 if test "x$BJAM" = x; then
   echo -n "Building Boost.Build engine with toolset $TOOLSET... "
- (cd "$my_dir/tools/build/v2/engine" && ./ "$TOOLSET") >
bootstrap.log 2>&1
+ (cd "$my_dir/tools/build/v2/engine" && ./ mingw) > bootstrap.log
   if [ $? -ne 0 ]; then
       echo "Failed to build Boost.Build build engine"

Of course, this is completely unacceptable for other toolsets, but I
basically know nothing about Boost's build machinery, so I can't figure out
a real fix.

Ideally, followed by b2.exe would work automatically, without
toolsets being specified. However, I would still be extremely happy if it
worked with manually specified toolsets, as long as I didn't have to patch
or sed files.

The second and third breaks are new to 1.54.0 and are tracked by . Here are my fixes that should
work for all platforms:

diff -aurN boost_1_54_0/tools/build/v2/engine/build.jam
--- boost_1_54_0/tools/build/v2/engine/build.jam 2013-05-20 21:14:18
+++ boost_1_54_0-fixed/tools/build/v2/engine/build.jam 2013-07-18 00:12:43
@@ -483,8 +483,8 @@
     make.c make1.c mem.c object.c option.c output.c parse.c pathsys.c
     rules.c scan.c search.c subst.c w32_getreg.c timestamp.c variable.c
     modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c
- modules/set.c modules/path.c modules/regex.c modules/property-set.c
- modules/sequence.c modules/order.c ;
+ [ .path modules set.c ] [ .path modules path.c ] [ .path modules
regex.c ]
+ [ .path modules property-set.c ] [ .path modules sequence.c ] [ .path
modules order.c ] ;
 if $(OS) = NT
     jam.source += execnt.c filent.c pathnt.c ;

It appears that build.jam needs to use this .path machinery to generate
either forward slashes or backslashes. When forward slashes are literally
used, the bootstrap complains that it doesn't know how to make the
corresponding object files. Once this is fixed, the final break is revealed:

diff -aurN boost_1_54_0/tools/build/v2/engine/
--- boost_1_54_0/tools/build/v2/engine/ 2013-05-20 21:14:18 -0700
+++ boost_1_54_0-fixed/tools/build/v2/engine/ 2013-07-18 00:12:43
@@ -247,18 +247,18 @@
  command.c compile.c constants.c debug.c execcmd.c frames.c function.c
  hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c
- object.c option.c output.c parse.c pathsys.c pathunix.c regexp.c rules.c\
+ object.c option.c output.c parse.c pathsys.c regexp.c rules.c\
  scan.c search.c subst.c timestamp.c variable.c modules.c strings.c
  builtins.c class.c cwd.c native.c md5.c w32_getreg.c modules/set.c\
  modules/path.c modules/regex.c modules/property-set.c modules/sequence.c\
- BJAM_SOURCES="${BJAM_SOURCES} execnt.c filent.c"
+ BJAM_SOURCES="${BJAM_SOURCES} execnt.c filent.c pathnt.c"
- BJAM_SOURCES="${BJAM_SOURCES} execunix.c fileunix.c"
+ BJAM_SOURCES="${BJAM_SOURCES} execunix.c fileunix.c pathunix.c"

(It took me quite some time to figure out this one.) Although pathunix.c
compiles on MinGW, it doesn't work, causing the bootstrap to complain about
not being able to write its command file. The correct pattern to follow (as
correctly done in build.jam; you can see half of it at the bottom of the
build.jam diff here) is for pathnt.c to be used for mingw and pathunix.c to
be used for all other platforms (i.e. real Unixes).

Stephan T. Lavavej

Boost list run by bdawes at, gregod at, cpdaniel at, john at