Opened 11 years ago

Last modified 8 years ago

#5680 new Bugs

bootstrap Boost.Build fails with MinGW 20110530: missing sys/wait.h, sys/resource.h, ar.h

Reported by: Alex Millian Hankins <lx_boost@…> Owned by:
Milestone: To Be Determined Component: Building Boost
Version: Boost 1.46.1 Severity: Problem
Keywords: mingw bjam bootstrap build Cc:

Description

My OS is Windows XP Pro.

To reproduce:

  • Install MinGW 20110530.
  • Download and uncompress boost_1_46_1.tar.bz2.
  • Launch MinGW Shell from Start menu.
  • Verify path:
$ printenv PATH
.:/mingw/bin:/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem
  • cd and run bootstrap:
$ cd boost_1_46_1/tools/build/v2
$ sh bootstrap.sh
Bootstrapping the build engine with toolset gcc...
Failed to bootstrap the build engine
Consult 'bootstrap.log' for more details
$ cat bootstrap.log
###
### Using 'gcc' toolset.
###
rm -rf bootstrap
mkdir bootstrap
gcc -o bootstrap/jam0 command.c compile.c debug.c expand.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c newstr.c option.c output.c parse.c pathunix.c pathvms.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c pwd.c class.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c
builtins.c:32:23: fatal error: sys/wait.h: No such file or directory
compilation terminated.
execunix.c:17:26: fatal error: sys/resource.h: No such file or directory
compilation terminated.
fileunix.c:97:17: fatal error: ar.h: No such file or directory
compilation terminated.

Surrounding the above failed includes with #ifndef __MINGW32__ ... #endif did not fix the problem.

Change History (5)

in reply to:  description comment:1 by thekyria@…, 11 years ago

Keywords: mingw bjam bootstrap build added
Severity: ShowstopperProblem

Replying to Alex Millian Hankins <lx_boost@…>:

$ cd boost_1_46_1/tools/build/v2
$ sh bootstrap.sh

As of boost_1_48_0, should instead be (msys):

$ bootstrap.sh mingw

Or (cmd):

> bootstrap.bat mingw

Which would produce the bjam.exe (and b2.exe) you need.

See also: #6143

comment:2 by valentin.perrelle@…, 11 years ago

The given solution doesn't work as intended in 1.49. Need to use the --with-toolset option, and substitute gcc by mingw in the produces bjam configuration file :

./bootstrap.sh --with-toolset=mingw
sed -e s/gcc/mingw/ project-config.jam > project-config.jam

comment:3 by Marcin Wojdyr <wojdyr@…>, 9 years ago

It still doesn't work in 1.55.

When bootstrap.sh is run without toolset specified, it first guesses toolset as mingw, but then

  case $guessed_toolset in
[...]

    mingw )
    TOOLSET=gcc
    ;;

so $guessed_toolset is set to mingw but TOOLSET is set to gcc instead, and bootstrap fails while compiling BJAM_SOURCES. Specifying --with-toolset=mingw avoids this substitution, but in jam file gcc must be used.

Here is a patch that makes it work.

  • bootstrap.sh

    old new  
    187187if test "x$TOOLSET" = x; then
    188188  guessed_toolset=`$my_dir/tools/build/v2/engine/build.sh --guess-toolset`
    189189  case $guessed_toolset in
    190     acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp )
     190    acc | darwin | gcc | como | mipspro | pathscale | pgi | qcc | vacpp | mingw )
    191191    TOOLSET=$guessed_toolset
    192192    ;;
    193193
     
    195195    TOOLSET=intel
    196196    ;;
    197197
    198     mingw )
    199     TOOLSET=gcc
    200     ;;
    201 
    202198    sun* )
    203199    TOOLSET=sun
    204200    ;;
     
    320316  mv "project-config.jam" "project-config.jam.$counter"
    321317fi
    322318
     319if test "$TOOLSET" = mingw; then
     320  TOOLSET=gcc
     321fi
     322
    323323# Generate user-config.jam
    324324echo "Generating Boost.Build configuration in project-config.jam..."
    325325cat > project-config.jam <<EOF

comment:4 by anonymous, 8 years ago

Seems to be still a problem in 1.58. With the help of your workaround I was able to build under Windows 7 and MinGW.

in reply to:  4 comment:5 by anonymous, 8 years ago

Replying to anonymous:

Seems to be still a problem in 1.58. With the help of your workaround I was able to build under Windows 7 and MinGW.

The sed replacement should go the other way around, though. This is what I used:

sed -i 's/\bmingw\b/gcc/' project-config.jam

Note: See TracTickets for help on using tickets.