Skip to content
Search

Boost:Mingw-w64

lastmod 2018-08-17created 2014-08-1410 edits

Describes how to build Boost using MinGW-w64 (x86_64 version MinGW).

Boost MinGW-w64 compile

Download

First, download the latest version of Boost from the site below.
http://www.boost.org/ or http://sourceforge.net/projects/boost/

Dependency

  • Python
  • ml.exe (MASM compiler: bundled with Visual Studio installation)
  • MinGW-w64 <span style='color:red'>(WARNING: It is best to register BIN in the PATH environment variable in advance.)

Compile bjam

You need to install bjam, the Boost build program.
It can be downloaded separately (here), but it is also bundled with the Boost source code download. It can be found at the path below.

%BOOST_ROOT%/tools/build/src/engine

At this location, first compile bjam as follows.

build.bat gcc

If it compiles successfully, b2.exe and bjam.exe are created in a directory called bin.ntx86_64.

Build boost

  1. First, run the Visual Studio x64 Win64 Command Prompt (2010). 1
  2. Move to the root directory where Boost is installed2.
  3. Enter the following.
.\tools\build\src\engine\bin.ntx86_64\bjam.exe toolset=gcc address-model=64 variant=debug,release link=static,shared threading=multi install

Finally, the compiled libraries are installed in C:\Boost. Note that applying all of the options above takes quite a long time (over 1 hour).

For reference, the options actually used are as follows.

.\tools\build\src\engine\bin.ntx86_64\bjam.exe --prefix="D:\\libs\\boost-1.56.0-build" --layout=system toolset=gcc address-model=64 variant=debug,release link=static,shared threading=multi install > build.log

Building Boost with MinGW-W64

You will require the following software:

  • MinGW-w64 Toolchain (from here)
    • for 32bit hosts targeting 32bit or 64bit
    • for 64bit hosts targeting 64bit
  • Boost Sources (from here)
    • for example boost_1_46_1.7z

Optionally:

  • Perl (from here)
    • May not be required.
  • Boost Jam Sources (from here)
    • for example boost-jam-3.1.18.zip
    • Or you can simply use the bjam from the Boost Sources

64bit Build

Add the tools to the PATH

set PATH=c:\mingw\mingw64\bin;%PATH%

Compile Boost-Jam (you can use the 32bit version instead if you compiled it already)

c:
cd \mingw\src\boost-jam-3.1.18
build.bat gcc

Compile Boost (If using the 32bit bjam.exe, Make sure you use the correct path)

c:
cd \mingw\src\boost_1_46_1
..\boost-jam-3.1.18\bin.ntx86_64\bjam.exe --prefix=c:\mingw\boost64 toolset=gcc address-model=64 variant=debug,release link=static,shared threading=multi install

(You might have to add define=BOOST_USE_WINDOWS_H to the parameter list.) You will now have a c:\mingw\boost64 directory containing the boost headers and libs :-)

Notes

  • You will see several message regarding python which should be safe to ignore.
  • You will see some message stating that 64bit is not supported for some parts of boost. If these are parts you need you should contact boost for support.
  • If you have instructions for cross compiling boost from linux, Please contact the mingw-w64 mailing list to get this page updated.

Troubleshooting

  • If the Thread (threading-multi) related libraries are not installed properly, the log will say that 'ml' cannot be found. ml here is not the ML language but ml.exe, the MASM compiler executable. Running bjam.exe from the Visual Studio command prompt installs them properly.
  • If the message undefined reference to &#96;_Unwind_Resume' is printed, check the compiler version again (this message is printed when it is not correct).

Favorite site

Issue ticket

References


  1. For reference, the command line is: %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" amd64 ↩

  2. The location where the bootstrap.bat file exists ↩

  3. (Related to the message undefined reference to `_Unwind_Resume') ↩