Compiling boost thread using mingw64

March 5, 2011

A short note on crosscompiling boost for 64bit windows using mingw64.

First get a build of mingw64 eg. from

http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Automated%20Builds/

I did use mingw-w64-bin_i686-linux_20110206.tar.bz2 since the build system is 32bit linux.

Get a recent version of the boost libraries.
Update the path to reflect where mingw64 was put.
Unpack boost and add a corresponding definition of gcc to tools/build/v2/user-config.jam
Mine was

using gcc : mingw64 : x86_64-w64-mingw32-g++ : 4.6 ;

Then build boost with bjam.

./bootstrap.sh
./bjam --layout=versioned --tolset=gcc-mingw64 define=BOOST_USE_WINDOWS_H address-model=64 threadapi=win32 target-os=windows --with-thread stage

The define=BOOST_USE_WINDOWS_H is crucial else the compilation will fail.

Advertisements

3 Responses to “Compiling boost thread using mingw64”

  1. Fabien Says:

    Thanks a lot. I think there is a little mistake in bjam arguments. “–toolset=gcc-mingw64” should be specified instead of “–tolset”.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: