Boost - Building from source

Boost is a comprehensive and portable libraries. It provides libraries from Math, IO, Network, etc... You can check out the list of libraries here. The main reason for my interest in this libraries is their portability. They had figured out the the x86 and x64 portability issues on these libraries. All you need is to compile the source with appropriate switches for your code. Moreover, this is a free library that can be used both commercial and non-commercial usage.

How to build from source

Follow the step to build the Boost from source.

1. Download latest version here

2. Unzip/untar the downloaded source

3. Use command prompt to run bootstrap.bat for Windows and bootstrap.sh for Linux

5. Then, run the following bjam for build

Bjam linux 32 bit with GCC

./bjam --build-dir="/root/boost_1_46_1/lib" --build-type=complete toolset=gcc address-model=32 architecture=x86 link=static --with-thread --with-serialization

Bjam Window commands 64 bit with MSVC 10

bjam --build-dir="C:\Boost\boost_1_46_1\lib" --build-type=complete toolset=msvc-10.0 address-model=64 architecture=x86 link=static --with-system --with-date_time --with-regex

Important switch to take note

--build-dir=

It allows you to specify the output of the libraries builds

toolset=[gcc|msvc-10.0]

It allows you to set the compile toolset for the source. For my example, it uses gcc and msvc-10.0

address-model=[32|64]

It allows you to defined to compile 32/64 bits libraries

link=[static|shared]

It allows you to build static or shared libraries

--with-xxxxx

It allows you to specify which specific to be built. For example, --with-system --with-date_time --with-regex means to build only system, data_time and regex libraries

See:

Comments

  1. Thanks for giving the list of libraries and also the steps to build the boost from source.It really helped me to sort out the issue I was facing.Thanks
    digital signature Adobe Reader

    ReplyDelete
  2. I am glad it helps :) I always hate looking up and down just to find steps to resolve an issue. Nonetheless, this solution works for me and hope it helps others

    ReplyDelete

Post a Comment

Popular Posts