Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need help to build Boost from source for MinGW

I was trying to build Boost library from source for MinGW. The Boost website says no guarantee but there seem to be people done it successfully. However I couldn't find much instructions on the web.

I updated the title to better reflect my problem right now.

======================== Original post ==============================

I downloaded Boost 1.53.0, unzipped it and cd to the folder in MinGW shell. It failed at the very first step I tried:

$ ./bootstrap.sh mingw
Building Boost.Build engine with toolset gcc...
Failed to build Boost.Build build engine
Consult 'bootstrap.log' for more details

Inside the bootstrap.log the errors are:

builtins.c:33: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:98:17: fatal error: ar.h: No such file or directory
compilation terminated.

Please help! Thanks!

================== End of original and beginning of update =====================

Update: I found this detailed instruction on line: http://vijay.axham.com/blog/478/building-boost-binaries-on-mingw

I followed it along and now got stuck in the final build step that is supposed to take a long time but I got an error instead:

$ b2  --build-dir=$BOOST_BUILD_DIR --prefix=$BOOST_INSTALL_DIR toolset=gcc variant=release link=static threading=multi runtime-link=static install 2>&1 | tee $BOOST_BUILD_DIR/build.log
error: Unable to find file or target named
error:     'boost/tr1/tr1/bcc32'
error: referred from project at
error:     '.'

but the directory is there (it should be since it's just extracted from the zip file)

$ ls boost/tr1/tr1/bcc32/
array.h  random.h  regex.h  tuple.h  type_tra.h  unordere.h

Getting closer but still need help! Thanks!

like image 337
astackdummy Avatar asked Jun 06 '13 16:06

astackdummy


People also ask

Where do I put Boost library?

Building the special stage target places Boost library binaries in the stage/lib/ subdirectory of the Boost tree. To use a different directory pass the --stagedir=directory option to b2. b2 is case-sensitive; it is important that all the parts shown in bold type above be entirely lower-case.


2 Answers

OK I got it working. The trick was to download the tar.bz2 file, not the zip file from sourceforge (specifically http://sourceforge.net/projects/boost/files/boost/1.53.0/). Even though both the zip and the tar.bz2 files are listed under the same file folder for the same version of Boost, the contents are different. There are some missing folders in the zip file, and the line ending conventions of the compressed files are different. At any rate after I downloaded and extracted the tar.bz2 file. I followed the instructions given here:

http://vijay.tech/articles/wiki/Programming/Cpp/Boost/BuildingBoostOnMinGw

and successfully built the Boost library from source using MinGW shell (mintty to be exact). There were some failures but probably not important: has_icu_test, has_iconv, has_icu_obj, has_icu64_obj, .masm. At the end it says

...failed updating 2 targets... ...skipped 3 targets... ...updated 10623 targets...

Hope this will help others in the future.

like image 77
astackdummy Avatar answered Sep 22 '22 17:09

astackdummy


Do not use bash. Build it using cmd.exe.

bootstrap.bat gcc

Compiler executable should be on PATH.

like image 29
Juraj Ivančić Avatar answered Sep 21 '22 17:09

Juraj Ivančić