Help Installing boost: building libraries

Hi, LeafyCircuits here!

Comp Specs:
OS: Windows 7 Home Premium 64-bit
Compiler: MinGW v4.6.2 running C++11 (separate from Code::Blocks)
IDE: Code::Blocks v12.11

I've finally decided I want to install 3rd-party libraries and I need some help doing so. I want to install Boost 1.54.0 after hearing about how great it was, and after previewing some of it's capabilities, I quite agree; and I even have a use for Boost at the moment. However, I would like to get the full experience of Boost, so I want to build the libraries that it requires it to be built, but I have no Idea how. I've done many Google searches, and none really show a user-friendly step-by-step process for building. I know, from what I glanced, is that I'm going to be using Windows Command Prompt to run that "bootstrap.bat" script. But I have no idea what to do from there (what to invoke, what directory trees to create, etc.). I also know that they have "specialized" Boost for Visual Studio to work very well, but as you can see, I have Code::Blocks, which means I'm not running any special consoles.

SO, if anybody would care to explain how to install Boost for Code::Blocks on Windows, please please respond. Thanks so much.
Last edited on
Open a command prompt, change directory to your MinGW (if you are using the default that ships with C::B it should be
C:\Program Files (x86)\CodeBlocks\MinGW
) and execute mingwvars.bat.

Then change directory to where you extracted boost.

Run
bjam --toolset=gcc "--prefix=<installpath>" install
where <installpath> is where you want boost installed.
IIRC - boost is header only, and can thus not be installed like a library. But you can "install" it by placing the include folder somewhere on your system and just use that folder as a search directory.

Or I am totally wrong, if (wrong) i_am_sorry();.
naraku9333 said:
Run
bjam --toolset=gcc "--prefix=<installpath>" install
where <installpath> is where you want boost installed.


But don't I need to install BoostJam? I also don't really know how to do that.
You may have to compile bjam... Or you can google it and get it and just place the EXE where you extracted Boost.

A couple of important notes (in random order):

1) It takes all night to compile everything. Make sure you are sleeping or something so that it has time to finish. Also, make sure your computer won't automatically go into power-down mode while you are away...

2) Make sure you place Boost in a path that DOES NOT CONTAIN SPACES!

3) If you plan to use Boost::Locale and the like to do extra-cool stuff, you'll need to install ICU first. (Which is shockingly easier to do than Boost.) If you don't need it right now, don't bother...

4) I recommend you unzip the boost libraries to C:\Boost and compile from there. Once you are done, use explorer to move the C:\Boost\include directory to C:\MinGW\include\boost (or wherever Code::Blocks put your MinGW).

Then use explorer to copy everything in the C:\Boost\lib directory to C:\MinGW\lib.

Once you have moved those two directories, you can delete C:\Boost.

What this does is integrate the Boost libraries with your installation of MinGW. If you ever upgrade MinGW you will have to recompile the boost libraries anyway, so it isn't too much to have to deal with.

5) My version of Boost had an error in the makefiles... I don't remember exactly where it was... but it aborted the install pretty quickly. You might have to find the error and fix it yourself. The installation process produces a lot of output, so if you get stuck you can track down where the error happened.

If that is too much for you, let me know what version of Boost you are trying to install and your version of MinGW/GCC and I'll see if I can figure it out for you.

Seriously, ICU is much easier to install...

Hope this helps.

[edit] Oh yeah, @kefin you recall incorrectly. Most of the libraries in Boost are, in fact, header only. But some important ones: filesystem, regex, locale, etc. do require compilation.
Last edited on
@Duoas - Thanks for the information!
naraku9333 said:
and execute mingwvars.bat.


Well, I installed MinGW separately from Code::Blocks; I don't use Code::Block's MinGW (I've adjusted my paths accordingly). I can't find this "mingwvars.bat" in my MinGW directory (C:\MinGW).
What MinGW distro do you use? If you have MinGW set up correctly in your path you wont need it, it just sets up environment variables.
naraku9333 said:
What MinGW distro do you use?


I used the installer provided by the official MinGW site: http://www.mingw.org/
to install MinGW v4.6.2 with C and C++ compilers. I did not install Fortran or any of the other options.
I use nuwen's distro http://nuwen.net/mingw.html it uses 4.8 and comes with boost. Also, the MinGW that comes with Code::Blocks 12.11 is TDM-4.7.1 so it's moreup to date then the version you are using.
naraku9333 said:
comes with boost.


Wait, comes with boost? Then, this is amazing! But then that kind of defeats the purpose of this thread, oh well.

Now that it's installed, is that it, or do I have to run any scripts, etc.?
(I see some batch files, so that worries me XD)
you do not need bjam.

what you have to do is typing this two lines (in the boost directory):
bootstrap
b2

if it doesn't find the compiler automatically you might call
toolset=gcc --build-type=complete stage


it's that easy, really. See
http://www.boost.org/doc/libs/1_54_0/more/getting_started/
Ah well, all in all, through nuwen's distro up there (thanks naraku9333), I was able to get boost. I mean, I still don't quite know how to build libraries, but the goal in the end was to get boost, so I guess that works.

Thanks everybody for the help! :)
@coder777
You do realize that "bootstrap" builds bjam, and "b2" is bjam, right?

I have found it more difficult to build bjam than to compile boost correctly.
Topic archived. No new replies allowed.