Boost 1.37 pre-built for MSVC - c++

I can't find a pre-built set of MSVC++ libs for Boost 1.37.0, only the source. I don't understand how their weird build system works... are there any places I can find a download of a visual studio project or something?

The BoostPro Computing folks maintain the Boost installer for Windows but it usually take a few weeks for them to put new versions online. It's not yet up for 1.37.
There's no Visual Studio solution (remember, Boost targets many platforms) though there is an effort to also support building Boost with CMake. I'm not sure how far along they got for 1.37 but I believe it's still early days for this process.
However the standard build system isn't that weird! Start by downloading bjam for your platform (look for a suffix of 'ntx86' for Windows) and installing it somewhere in your path (C:/Windows/System32). Then download the source, uncompress it and run the build system from the command line. It'll look something like this for Visual Studio users:
bjam --build-dir="C:\boostsource" --toolset=msvc --build-type=complete stage
This is lifted pretty much from the Getting Started Guide which goes into much more detail. The build-dir is not needed if you're current directory is the root of the source.
After waiting a couple of hours for everything to build ('complete' means that it'll build debug, release, single/multi threaded, static/dynamic, static/dynamic linking to the runtimes - and combinations) you'll end up with all of the libs in a 'stage/lib' directory.
Finally you need to tell Visual Studio where to find the headers and libs. Go to Tools->Options->Projects and Solutions->VC++ Directories. Add an entry for "Include files" (like "C:\boostsource"). Add an entry for "Library files" ("C:\boostsource\stage\lib").

I've got a build of 1.37 (VC 7.1, 8, 9) on my website, help yourself.
http://boost.teeks99.com/
(Update... 1.38 is up there as well)
(Another Update, 1.39 is now there)
(1.40 is up)
(1.41 is up, a bit late)

It seems complicated, but building Boost is really not that bad. First you need to download the bjam tool (SourceForge is a good source). Make sure bjam.exe is in a directory in your PATH.
Go the the root of your unzipped Boost download (e.g. C:\Boost_1_37_0)
Type bjam --help to get a list of all your build options.
I use the following command to build everything, you can customize it to suit your needs:
bjam --prefix=C:\boost --build-dir=C:\build --build-type=complete install
The results will be placed in C:\boost and you can delete C:\build.

Building it isn't difficult.
They have a fairly good expanaltion of the default process here:
http://www.boost.org/doc/libs/1_37_0/more/getting_started/windows.html#or-build-binaries-from-source
Download bjam (from sourceforge, there are links from the boost website), as well as the boost sources, make sure bjam is accessible from the boost dir, cd to the boost dir, and run something like the following:
bjam --build-dir= --prefix-dir= --toolset=msvc --build-type=complete install
where is an temp dir where it can store intermediate files, and is the final install location. There are all sorts of other options you can play around with, and not all of them are documented very well, but the basics are fairly simple.
For more help, you can run bjam --help from the boost source dir.

Related

What is a staged boost library?

While trying to build the thrift c++ library, I came across the following error after specifying the --with-boost option.
If you have a staged boost library (still not installed) please
specify $BOOST_ROOT in your environment and do not give a PATH to
--with-boost option.
I looked through the boost documentation (which is I am not overly familiar with), but I did not find a good definition for the term staged boost library. I see the parenthetical (still not installed), but there are many states that are a library can be in that fall under the category of not installed.
When I first download boost, I run ./bootstrap and ./b2 to compile it.
Is it staged at this point? Or do I have to do something else to make it staged?
You can call
b2 --help
to see options of Boost.Build, and there you can find
install Install headers and compiled library files to the
======= configured locations (below).
...
stage Build and install only compiled library files to the
===== stage directory.
The declaration of stage or install specifies whether the Boost Libraries are installed in a subfolder named stage or system-wide. The meaning of system-wide depends on the operating system. In Windows, the target directory is c:\boost, in Linux it is /usr/local. The target directory can also be explicitly specified using the -–prefix option. Also see this answer, I guess it will be helpful.
For more informations see Getting Started Guide for Windows or Linux.
When you run .\b2 to compile Boost, it create a folder called stage and output of the compilation is put inside %BOOST_ROOT%\stage\lib folder. Now you can copy this lib folder somewhere and add that in to linker's path. However some projects might expect binaries to be available at stage\lib. So "staged" here means if you have libraries compiled and present in stage\lib folder. The .b2 command takes several different parameters to compile different kids of binaries, for example, below compiles binaries that are linked to shared runtime and targeting x64 architecture:
b2 variant=debug,release link=shared runtime-link=shared address-model=64
Each variant of lib file name has tags so they don't overwrite each other, for example, libboost_date_time-vc140-mt-gd-1_62.lib.

How to configure Qt Creator to use Boost in Windows

I created a Qt project in Ubuntu and everything went smoothly. However, I also need deploy it on Windows. It uses Boost libraries(the big problem).
I've been searching for hours to find a solution, but didn't have luck. I tried to install Boost libraries and link it with mingw; I think I missed something. Here is what I did and downloading the lastest version:
1) ran .\bootstrap
2) then .\b2 --prefix=C:\boost install
Sadly didn't install correctly. I got only 2 folder(bin and share) but no headers.
However, here (http://nuwen.net/) I found a bundle(Mingw+Boost and other libraries). This has everything I need.
Now I think the issue is .pro file, because I have a lot of undefined references. Here is .pro file with everything I tried (some commented):
http://pastebin.com/pBFMTAd8
Your help is appreciated!
I did solve the problem myself. And here is how I did it. First of all, it is required to have boost library compiled with same compiler you're using with Qt.
If you're using msvc, then you're lucky because Boost guys did you a favour and compiled libraries for you. You can download them here: http://sourceforge.net/projects/boost/files/boost-binaries/ .
If you're using mingw (which does come in bundle with Qt), you can do this:
add mingw compiler to Windows PATH variable:
~ go to control panel and search for System;
~ add mingw's path(e.g. C:\Qt\Tools\mingw\bin) to PATH variable by appending ';' to your path(e.g.: ";C:\Qt\Tools\mingw\bin")
compile Boost libraries:
~ unzip boost archive
~ open a Command Line window, go in the unzipped boost folder, then go in folder tools/build/v2/engine
~ you have you build installer with mingw toolset: .\build --toolset=mingw
~ this will create 2 files in folder bin.ntx86 or something similar; copy the files bjam and b2 in the unzipped boost folder;
~ now go in boost folder and start build it: .\b2 --toolset=mingw --build-type=complete stage (there is good tutorial to install it along with eclipse : http://theseekersquill.wordpress.com/2010/08/24/howto-boost-mingw/)
note: this gonna take few hours, so may want to watch a movie or what ever you want to do meanwhile. However you have the option to speed up things a little bit by adding another argument to the build command: -j N, where N is how many cores your processor have.
when build has finished, you can now link the library in Qt. To do this you need to modify .pro file. First you'll have to tell Qt where are headers are located, and you do so by adding:
INCLUDEPATH += path_to_boost_folder, e.g. : INCLUDEPATH += C:/boost_1_54_0
~ also if you're using libraries which requires link, for example system and filesystem you have to link them separately:
LIBS += "C:/boost_1_54_0/stage/lib/libboost_filesystem-mgw48-1_54.a",
LIBS += "C:/boost_1_54_0/stage/lib/libboost_system-mgw48-1_54.a"
after modifying the .pro file, run qmake, then rebuild.
Hope this works for you too!
Update: The folder hierarchy has change. For building the library, one should read the documentation associated with each version and Boost.Build's documentation.
Building the library from the root folder is easier (Building Boost 1.52 with MinGW):
C:\boost_1_60_0> bootstrap.bat mingw
C:\boost_1_60_0> .\b2 --toolset=gcc -j N --build-type=complete
building boost will not put the headers, the headers are for the developer when he creates new code. The installed dirs are the binaries for distribution.
see http://www.boost.org/doc/libs/1_54_0/more/getting_started/windows.html#prepare-to-use-a-boost-library-binary
this will install libraries, that you use at runtime (not compile time). Because you add this bin folder to your path and that is why when runing an app build with boost it will run and not say "could not find xxx.dll"

How on earth do i use Boost?

I'm reasonably new to C++, and I was going to mess around with threading for my Tamagochi game, however it seems that everything says I should get Boost for that.
So my question is, how on earth do I install it?
I've found ways of using it by doing the whole "Add the path in the properties" thing. And that works, however I'm guessing that if I use that way, I wont be able to compile and release it afterwards?
I also tried using BlueGo from vertexwahn.de.
but I have no idea what it actually does. I get the whole "It compiles the libraries for you" thing but, how do I use them then?
Should they work from within VS2012 without further tweaking, or do I still need to add in the path's in properties?
I just want to use the threading from Boost, and then build the project and send to a friend.
I was going to mess around with threading...
If my reading of MSDN is correct, Visual Studio 2012 appears to support the new threading features of C++ 11. With this in mind, you don't need to install Boost. You can just use the standard <thread> header instead.
Some boost modules have to be built.
For Windows, you have to use bjam.exe to build your libraries.
And bootstrap.bat will build you bjam.exe
From your unzipped boost directory :
bootstrap.bat
bjam.exe release debug toolset=msvc address-model=32 --build-type=complete
bjam.exe release debug toolset=msvc address-model=64 --build-type=complete
And check your stage/lib for *.lib, *.dll
(You may have to clean your stage/lib directory between two bjam commands)
Then, add include directory and library directory to your VS project.
Needed libraries will be automatically linked (you do not have to tell VS to use boost thread for example), boost use pragma to find out what is needed. It doesn't work for Linux though.
As previously stated, VS2012 already handle threads, but boost is much more than that and I strongly recommand using it for whatever you want to code.
With asio from boost, you can even make thread pool : see recipe
download boost
compile boost (go to the boost directory, call
bootstrap and after this is finished call b2)
decide which part of boost to use
add the main boost directory to your include path and the lib (with default it is in stage - just search for the lib files) directory to your linker path
make sure that you link boost thread dynamically (there may be problems if you link statically)
program

Boost libraries - build only what I need

I downloaded the Boost libraries and now I want to build only a few of the libraries. What would be the right command for this? Apparently the build-type=complete option gives me too much.
I am using Windows XP and want to use Bjam to compile Boost and MinGW to finally use it. At the moment I think I need the libraries Boost.filesystem, Boost.ProgramOptions and Boost.System.
Another question: Where do I put the header-only libraries?
In step 5.2.4 of Getting Started you can instruct b2 which libraries to build:
./b2 --with-program_options --with-filesystem --with-system
Alternatively, use ./b2 --show-libraries to see a list of all libraries that are not header-only.
Following is an excerpt from the page:
In particular, to limit the amount of time spent building, you may be interested in:
reviewing the list of library names with --show-libraries
limiting which libraries get built with the --with-<library-name> or --without-<library-name> options
choosing a specific build variant by adding release or debug to the command line.
Note: b2 command depends upon boost version so use following commands as per your boost version(Also, in this case use --with-libraries=<comma-seperated-library-names> version instead of --with-<library-name>):
./configure for 1.38.0 and earlier
./bootstrap.sh for 1.39.0 onwards till 1.46.0
These answers didn't work for me. On Windows, this worked for me:
b2.exe --with-LIBRARY
For example,
b2.exe --with-test
The BCP utility is a tool for extracting subsets of Boost. It's useful for Boost authors who want to distribute their library separately from Boost, and for Boost users who want to distribute a subset of Boost with their application.
The current version of Boost (1.50.0) uses Boost.Build. The new workflow for building BCP is as follows:
From the root Boost directory, type:
bootstrap.bat
Then, once Boost.Build has been built, type:
b2 tools/bcp
To extract, for example interprocess only, you could use:
$ mkdir /tmp/interprocess #bcp needs this
$ bcp interprocess /tmp/interprocess
This copies interprocess and its dependencies to /tmp/interprocess.
I had the same problem. But I found a way to create the necessary files.
Steps to follow:
If you have Microsoft Visual Studio 2010 then open the Microsoft Visual Studio command prompt (2010) in administrator mode.
First enter the code:
bootstrap.bat
Then enter the following code to generate lib files:
b2.exe link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-system --toolset=msvc-10.0 define=BOOST_USE_WINAPI_VERSION=0x0500
Library files will be created in stage folder.
My last build attempt for the Boost 1.55 libraries was a dissappointment. All attempts to build several libraries and only them has ended up with total mess in output.
BJam either tries to build everything or build only the requested, but in the "bin.v2/[long-random-path]" folders (library per directory) with crap in them which is a headache to copy only the link libraries to somethere else.
I have accidentally found the right way to build-and-collect only the libraries I want in one place without any other crap:
bjam ... --with-[library1] --with-[library2] stage
the "stage" option is required to build and collect libraries in one folder: /stage/lib
the "--with-[library]" option is required to build only the library you want.
An additional note for anyone who sees the error message:
"error: wrong library name '<name of library>' in the --with-<library> option.".
If you try to be clever, as I did, and only extract the boost sub-directory of the download onto your system to minimise space, b2 will not be able to find the source code and build options for those libraries that are not header-only. I.e. you need the lib sub-directory too (and tools).

Boost installation -Simplified Build From Source

As mentioned in the docs
what do i need to install to run the commands :
bootstrap
.\bjam
The BoostPro Computing folks maintain the Boost installer for Windows, but if I first run the installer and download a minimal build and then run the installer again, the installer doesn't detect that I've already installed Boost already and I need some more libraries. Is there a way around ?
Set up Your BOOST_ROOT environment variable first:
winXP:
set BOOST_ROOT=D:\your\boost\sources
then in the BOOST_ROOT directory run:
boostrap.bat
this will create your bjam.exe and it's environment.
Next step is to invoke:
bjam toolset=msvc stage
This will compile Your boost library and place all libs into the folder:
%BOOST_ROOT%\stage\lib
If you want to build everything use:
bjam toolset=msvc -a --build-type=complete stage
instead stage you can put install this will simply install this to lib.
During building there will be created huge directory bin.v2 with all object files.
Total installation is aprox: 1.5 GB for libs (shared+static+debug&release).
I also found this link in another post for boost binaries. Just downloading and its very helpful. If anyone has tried this out and had issues, let us know