Building boost 1.61.0 with MinGW 5.3.0 - c++

Has anyone had any success in building boost 1.61.0 for Mingw? I've Googled for this, and all the suggestions that apparently worked well in the past result in errors now. It doesn't help that boost's "Getting Started on Windows" page is a poorly structured, incomplete mess that seems to have been getting only the most rudimentary updates for a while now (there are even a couple of dead links in there). I somehow managed to build boost 1.58 for an older MinGW version, but that was quite a while ago and I foolishly neglected to write down the individual steps required to make it work. :-\

Ok, I did get it to work, but apparently the bug in the boost build system discussed here is still in boost 1.61. I worked around that by skipping the libraries that run into this problem and only building the ones that I need. Here's what worked for me.
Download and unzip boost_1_61_0.7z to D:\Dev\Libs\boost\boost_1_61_0
Extend PATH variable to contain bin folder that contains MinGW g++.exe, and make sure no other g++.exe instances appear in PATH before this one (that actually tripped me up the first time, because several programs I've installed come packaged with their own g++ version).
Open cmd window.
Run cd D:\Dev\Libs\boost\boost_1_61_0\tools\build
Run .\bootstrap.bat (if you skip this, step 6 will fail with 'Unknown toolset: mingw' ... WTF???)
Run .\bootstrap.bat mingw
Run .\b2.exe install toolset=gcc --prefix=D:\Dev\Libs\boost\boost_1_61_0\b2_for_mingw
Run cd D:\Dev\Libs\boost\boost_1_61_0
Run set PATH=%PATH%;D:\Dev\Libs\boost\boost_1_61_0\b2_for_mingw\bin
Run b2 toolset=gcc --build-type=complete stage --with-filesystem --with-system (since I only need the filesystem and system libraries).
EDIT: For boost 1.64, step 5 must be skipped entirely, and in step 6 gcc needs to be specified instead of mingw, as pointed out in the comments by user fest.

The answer from #antred worked pretty well. Only changes I needed to do to compile boost 1.67.0 is follows:
Instead of step 5 and 6 run .\bootstrap.bat gcc
At step 10 run b2 --build-dir="C:\Program Files\boost_1_67_0\build" --prefix="C:\Program Files\boost" toolset=gcc install

Related

Install boost 1.42 on Mint 17 Thread disabled

This is related to this question: Can't install Vision Workbench.
I need to install boost1.42 in order to compile Vision workbench. I have downloaded the 1.42 package http://sourceforge.net/projects/boost/files/boost/1.42.0/ and extracted it. First I run ./bootstrap.sh --prefix=/home/myname/ and then ./bjam install. Everything works fine except for
error: #error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS"
So the thread package is not installed correctly and that means I cannot generate a make-file for Vision Workbench.
Does anyone have an idea of how to solve it?
/ Erik
As per the instructions http://www.boost.org/doc/libs/1_42_0/more/getting_started/unix-variants.html
$ cd ~/boost_1_42_0
$ bjam --build-dir=/tmp/build-boost toolset=gcc stage
should build static and shared non-debug multi-threaded variants of the libraries. To build all variants, pass the additional option, “--build-type=complete”.
If this doesn't work for you, then potentially your toolset is not being detected correctly (try specifying it). This is not unlikely since Boost 1.42.0 is really old, and probably could never know about the compiler version you're using.
As an aside, the BOOST_DISABLE_THREADS is known to make no difference for recent boost version.

What do I do about "batch recursion exceeds stack limits" when running Boost.Build?

I am using 64-bit Win 7.
I downloaded the latest Boost source and in order to gather binaries I have to pass trough
Boost.Build process. I took also the latest Boost.Build from official website and when I
ran ./bootstrap I got an error:
****** B A T C H R E C U R S I O N exceeds STACK limits ******
Recursion Count=592, Stack Usage=90 percent
****** B A T C H PROCESSING IS A B O R T E D ******
I have i5, 8 GB of memory.
Is there some other way to gain binaries for boost for GCC (G++). I know that there is
Boostpro, but that can only give me VS binaries.
The answer has already given by Jesse Good and DevSolar
but needs some combination
for Windows + MinGW (gcc)
1) in CMD, under the root directory of Boost, type
.\bootstrap.bat gcc
the gcc argument will stop the Recursion Error
2) then b2 will be generated in the same directory
the simplest way to install is
.\b2 toolset=gcc --prefix="path\of\compiled\files\" install
the toolset=gcc argument is necessary, otherwise compiling of .dll will fail
3) add
"path\of\compiled\files\include\boost_?_??"
"path\of\compiled\files\lib"
to system path (you may google "add system path variable win", Win 7 needs NO reboot to activate the setting )
This error occurs when:
you are using the sources from the *.tar.bz2 package for a Windows build, and
you are not specifying a toolset.
Either using the *.zip source package or specifying the toolset (bootstrap.sh msvc or whatever) resolves this problem (for me, at least).
Go to tools\build\v2\ in the boost directory and run the bootstrap from there.
Run b2 toolset=gcc install --prefix=PREFIX from the same directory as above where PREFIX is where you want boost.build to be installed.
Add PREFIX\bin to your PATH environment variable, and then from the boost root directory type something like the following (this is an example, change the options as you wish, to find a list of the options, type b2 --help):
b2 toolset=gcc address-model=64 variant=release link=static,shared
threading=multi --layout=system target-os=windows
Hopefully that helps.
I have seen this happen when the Boost version is outdated and does not support the current toolset. For example, boost-1.57.0 does not support the VC15 compiler, and gave me your error message.
The simple solution was to use the most recent version of Boost.

Can't find bjam in boost homebrew installation

I installed Boost with homebrew(brew install boost) on my Mac running Lion with the purpose of extending python with an existing C++ program I have. Now I can't follow the starting guide because 1 - I don't have 'bjam' installed in my system and 2-I don't see the examples folder anywhere. My question is: how I am supposed to do the the c++-python linking with this homebrew installation without 'bjam'? is there some alternative method I should use or something I am missing here?
The right formula to install boost for linking c++ with python programs is:
brew install boost-build
as pointed out by senderle in the comments to my question. This installs bjam automatically.
For Windows, you go into $(BoostDir)\tools\build\v2\engine and run build.bat which automatically builds bjam (into the bin.ntx86 directory on windows). There is a build.sh file there too, but I've never used a Mac so I don't know if that will work for you. Otherwise, just do a Google search for a precompiled bjam executable for Mac OS X.
It should just be a case of downloading Boost then running "Bootstrap" followed by "Bjam".
Bootstrap should build you a Bjam executable in the Boost folder.

Failed to build boost

I have been able to compile boost on Windows Vista using the following commands:
bootstrap.bat
bjam.exe --with-filesystem --with-thread --toolset=msvc
However, when I issue the same command on Windows 7, I get this:
'failed to write output file 'bin.v2\libs\thread\build\msvc-8.0\release\link-static\threading-multi\libboost_thread-vc80-mt-1_48.lib.rsp'!'
What am I doing wrong?
I had this and the problem turned out to be that boost seems to have some problems with long path names. Moved the directories up a couple of levels and it all started working. But had me pulling my hair out for a while
You can use bjam.exe --abbreviate-paths
Found here: http://lists.boost.org/boost-build/2007/01/16028.php
I had similar problem and this switch helped me a lot (although it is not documented).

How do I install the boost library to my MinGW compiler?

I'm compiling from the command line using g++ on a Windows MinGW installation. How do I get boost...conceptually or if it is easy...what do I need to download and install?
I know this is an old question but for future reference for anybody coming to this page try this website,
http://nuwen.net/mingw.html
They have done all the hard work so you don't have to. The most recent distribution on this page has boost 1_52_0 (which is the latest version on the boost website as I'm writing this) including the separately compiled libraries (e.g. boost thread, boost regex etc) which I beleive you're asking for
I spent hours searching for a good solution for Boost 1.54. If you already have MinGW and you're just looking for instructions on compiling the binary boost libraries, try this:
From your boost_X_XX_X directory, go to
.\tools\build\src\engine
and type:
build.bat mingw
This will create a folder called bin.ntx86 or bin.ntx86_64 depending on your architecture. Add this directory to your PATH environment variable.
Return to your boost_X_XX_X directory and type:
bjam toolset=gcc
This worked for me on my system. I'd be interested to know if other systems have trouble with these instructions.
However there would have been a simpler, yet identical way; your steps until the bjam call are automatically done by bootstrap.bat:
C:\boost_1_52_0> bootstrap.bat mingw
Building Boost.Build engine
...
C:\boost_1_52_0> b2 toolset=gcc
Reference: https://stackoverflow.com/a/13257930/2171309
Thanx to Neal Kruis. This worked for me. I have Qt 5.4 with mingw 4.9 installed. I downloaded boost 1.59. Go to "...\boost_1_59_0\tools\build\src\engine\" folder
set PATH=%PATH%;c:\Qt\Qt5.4.0\Tools\mingw491_32\bin
build.bat mingw
go to "...\boost_1_59_0\" folder, change boost path accordingly
set PATH=%PATH%;c:\boost_1_59_0\tools\build\src\engine\bin.ntx86
bjam toolset=gcc