Boost logo

Boost-Build :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2007-02-14 14:12:26

Since I had a rather long way to figure out if/how it is possible to have cygwin
and mingw compilers in a side by side installation, I thought it would be a nice
idea to share this information.

This post also is related to my post: "cygwin builds are running with wrong

1) What do I mean by mingw and cygwin?

    By mingw I refer to the toolset, compiler and library available from:
    I downloaded the 3.4.5 and 3.4.2 versions and installed (copied) them
    each into their own directories.

    By cygwin I refer to the cygwin environmet, for which an installer is
    available e.g. from here :

2) Compiling from the command line.

    Command line in context of this post means: Invoking builds from the
    Windows command interpreter CMD.EXE.
    Compiling from the bash inside the cygwin environment is not covered

3) The easy way: Using a single toolset at a time.

    As the title say it: Make sure your compiler's bin dir comes first in your
    PATH environment variable.
    E.g.: for mingw 3.4.2
    or cygwin :
    (The Tools directory is, where my bjam.exe lives.)

    Depending on your PATH variable the command (e.g. from boost-root)
    bjam toolset=gcc --with-thread stage
    will compile the threading library for the respective toolset and put
    the results into the stage directory.

4) Using a mixture of gcc toolsets.

    When you need to specify more than one toolset on the command line, or
    you cannot change the PATH for each build, the previous approach will
    not work. The Boost.Build has no way to find out which compiler you are
    refering to by looking into the PATH variable only.

    You need to set up a user-config.jam file. Unfortunately this is not
    straight forward for the gcc and only documented stintedly.
    I provide you with an example user-confg.jam to save you the guess work.
    I do not maintain, that it is the only possible setup, or even the most
    elegant one. (I would be glad if someone more knowledgeable than me teach
    me a better one.)

using gcc
     : 3.4.4
     : "C:/Cygwin/bin/g++.exe"
     : <flavor>cygwin
using gcc
     : 3.4.2
     : "C:/Programme/mingw-3.4.2/bin/g++.exe"
     : <flavor>mingw
using gcc
     : 3.4.5
     : "C:/Programme/mingw-3.4.5/bin/g++.exe"
     : <flavor>mingw

    Of course you will need to adjust the shown paths to reflect your
    Please also take care that the path to your cygwin bin directory is in
    your PATH variable! This is _not_ so that Boost.Build will find the
    compiler, but so as to allow the cygwin1.dll and other libs to be found
    in turn. No need for mingw or cygwin compilers in PATH.

    The bjam invocation is a little tricky, and I show two variants I found
    working. Again from boost-root as an example:
    *) bjam gcc-3.4.2-mingw --with-thread stage
       bjam gcc-3.4.4-cygwin --with-thread stage
       or even
       bjam gcc-3.4.2-mingw gcc-3.4.4-cygwin --with-thread stage

       but _not_
       bjam toolset=gcc-3.4.2-ming,gcc-3.4.4-cygwin --with-thread stage

       The last one while looking inncocent to me fails badly.

    *) bjam toolset=gcc-3.4.2/toolset-gcc:flavor=mingw
           toolset=gcc-3.4.4/toolset-gcc:flavor=cygwin --with-thread stage

    This one is more verbose or "systematic". The grouping by means of the
    ',' still not applicable.


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at