[scqb] Installing Boost

Preparing the complier


This tutorial will use Microsoft visual C++ compiler on Windows, and GCC on Ubuntu. Since the Qt 5.5 offers binary files in visual C++ 12.0 (2013), I will use this complier version for building Windows app. For Ubuntu, it is easier to use the gcc version that was offered by the software update repository. By default, you should get gcc 4.8 on Ubuntu 14.04, and gcc 5.1 on Ubuntu 15.10.


Installing micorosft visual C++ 12.0 (2013) for windows


The easiest way to get this complier is to download the Microsoft visual studio 2013 express for desktop to get the visual C++ 12.0 complier.


Installing GCC on Ubuntu


For Ubuntu 14.04 LTS, just running the apt-get command, you will get the gcc 4.8.
sudo apt-get install g++
Installing CMake

 

Installing Boost


Boost is also open source project. Boost’s license is so flexible that you can use boost as the static lib that link to you application without the need to open your source code. You can download the pre-complied boost package. However, this tutorial I will show you how to compile and install the boost from source code.

You can obtain the source code from Boost download link http://sourceforge.net/projects/boost/files/boost/1.59.0/. Then, extract the zip (or tar) file. Open command prompt, and cd to the extracted folder. Inside that directory (boost_1_59_0.7z\boost_1_59_0\), run these commands
1. Run bootstrap.bat (bootstrap.sh for Linux)
C:\boost_1_57_0\boost_1_57_0>bootstrap
2. Run b2.exe (b2 for Linux).

./b2 toolset=gcc link=static install address-model=64 --build-type=complete --build-dir=/opt/boost64/Build --prefix=/opt/boost64 --layout=versioned

See Table 1 for the detail of command arguments.


toolset=msvc-12.0 Use the visual C++ 12.0 2013 complier (For Linux, use toolset=gcc).
link=static Build as static lib.
Address-model=32 Set binaries’ architecture to 32 bit. Use Address-model=64 for 64 bit.
Install This argument will copy the output files to the prefix folder.
--build-type=complete Build both debug and release version.
--build-dir=C:\Boost\Build Directory for object files and caches (just intermediate files).
--prefix=C:\Boost The location of “output” library. In this tutorial, I will use --prefix=C:\Boost64 for 64 bit build. For Linux, I will set prefix to --prefix=/opt/boost.To customize this please see my CMakeList.txt.
--layout=versioned
Construct built libraries with the “versioned” format. See http://stackoverflow.com/questions/8940249/boost-how-bjam-constructs-a-library-name

 Table 1 the detail of command arguments
 
Notice the difference between double dash “--” and no dash. You possibly have some built failure on python-related libs and some other libs. You can simply ignore it, or just installs the required dependencies. Figure 1 and 2 show the screenshot of building boost.

Figure 1 Building boost on Ubuntu


Figure Building boost on Windows

No comments:

Post a Comment