I am installing boost library from its source boost_1_40_0.tar.bz2 on my Ubuntu 8.10. Following "./bootstrap.sh --prefix=path/to/installation/prefix" and "./bjam install", the compilation is very intensive and my system seems unable to take the burden and abnormally exits. I tried several times. All end in my system aborting. Everytime I was hoping it could go further somehow on what was left last time but it looks more like this is not the case.
So I wonder if it is also takes you much computer resources to compile the boost library (how long it takes and how much space the library will take).
What would you suggest to me to make the installation successful on my system.
Is possible to not install all the sublibraries? For example, now I am only interested in boost/statistics/accumulators. How to?
Thanks and regards!
I'm using --with-libraryname as bjam command-line argument to build only a part o boost.
For example for my mingw compiler command line to build boost would be:
bjam toolset=gcc --with-signals --with-filesystem --with-test --with-regex --with-iostreams --with-thread --with-program_options -sBZIP2_INCLUDE=. runtime-link=static link=static threading=multi --build-type=complete stage
-s sets CPP macro definition
stage - is bjam target to build
--build-type=complete will make Boost.Build generate release and debug versions of boost libraries
There are some other obvious options too. I don't remember why link option is duplicated, though.
Two quick comments.
Whenever I wanted a newer boost on Ubuntu, I took the most current Debian (source) package and simply rebuilt it as a local .deb package.
I have not had a chance to look at 1.40 yet, but the statistics/accumulators have been functional for several Boost releases now. Maybe you can use libboost1.37-dev as in Ubuntu 9.04 (i.e. upgrade Ubuntu, possibly even just partially by switching to these Boost versions and their Depends:) ?
There is also a boost-cmake build, if you like cmake. See
http://gitorious.org/~straszheim/boost/cmake
you want the 1.40.0 branch.
Related
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.
Sorry if this has already been asked? I've build boost from source but have always been confused about the build tools. Which tool should be used when building the boost libraries from scratch. To me it seems that bootstrap.sh is used to create the bjam executable and then bjam should be used to do the actual build. However, I've noticed that you can pass lots of parameters to bootstrap.sh such as the toolset (compiler) to use and the libraries to build, etc...and launch the build with bootstrap.sh
Also, there are at least three different ways of starting a build: ./bootstrap.sh, bjam, b2
Could someone summarize the purpose of each as the online docs don't seem to explain this
Thanks!
Anwar
b2 is just the second version of bjam. The bootstrap.sh script just builds the boost jam executable from the source code contained in the boost source, creates project-config.jam and executes the executable. You can see the shell script here
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).
I'm building Boost (I'm using System and FileSystem) for MinGW using bjam:
bjam --toolset=gcc stage
And it builds fine, but I want to be able to statically link to it (I have to have a single file for the final product) so I tried:
bjam --link=static --toolset=gcc stage
But I get the same output. Any ideas?
edit second question in a row I've answered moments after posting :p guess I'll leave this up here for others though.
bjam --build-type=complete --toolset=gcc stage
Will build both dynamic and static for sure.
I think link is a property as opposed to an option for bjam. That means that there should be no -- before it.
This is my command line for building only static libraries (visual c++ though):
bjam install --toolset=msvc variant=release link=static threading=multi runtime-link=static
Mapping that to your original build command I would say it should look something like this:
bjam --toolset=gcc link=static stage
or perhaps:
bjam stage --toolset=gcc link=static
Try running
bjam --help
for more info on properties and options for bjam.
Just want note that with the newer boost (Feb 2011) you need to build bjam as well now.. for some reason the current downloadable bjam doesn't work cleanly.
So first:
cd ...\boost_1_45_0\tools\build\v2\engine\src
build.bat mingw
Youll need to add bjam to the PATH (from control panel, not just on the cmd prompt). Then
cd ...\boost_1_45_0\
bjam --build-type=complete --toolset=gcc stage
My setup is Vista, Boost 1.45, MinGW 4.5, and building from cmd.exe not msys.
http://code-slim-jim.blogspot.com/2011/02/boost-in-vista-using-mingw-and-cmdexe.html
I have not built this myself in MinGW but I believe your first build will output both dynamic and static libraries and the second only static ones, so if you did not clean the build directories in between builds it will probably look the same.
When you write "I have to have a single file..." do you mean you need a single library containing all boost libraries? If so, I suspect you may have to 'ar' them together yourself.
I use the following command line to build both the statically linked as well as the dynamically linked versions of boost:
bjam "-sBUILD=debug release <runtime-link>static/dynamic <threading>multi" stage
This is done with visual c++ on windows YMMV.
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.