Skip to content

Boost Library Building

miketsivinsky edited this page Feb 27, 2018 · 7 revisions

Linux

  1. Load boost current release from http://www.boost.org/users/download/ - tarball file.

  2. Unpack archive to tmp directory. Default name as archive name, i.e: archive: boost_1_66_0.tar.gz dir: /opt/dist/boost/boost_1_66_0

  3. Run the following commands (specify prefix to desired location):

./bootstrap.sh --prefix=/opt/cad/boost/1_65_1 --with-python=/usr/bin/python3 
./b2
./b2 install
  1. Add boost library path to shared library search paths by adding the path to /etc/ld.so.conf and launc ldconfig.

Windows

  1. Load boost current release from http://www.boost.org/users/download/. It's better to download 7z archive - less size and more fast unpacking (compare to zip).

  2. Unpack archive to tmp directory. Default name as archive name, i.e: archive: boost_1_66_0.7z dir: e:\distrib\boost\boost_1_66_0

  3. Run bootstrap.bat at root dir, i.e: e:\distrib\boost\boost_1_66_0\bootstrap.bat

  4. The recommended way is: create file user-config.jam in %HOME% directory (i.e. d:\home) Fill this file info about Python which you want to use, file contents example:


using python 
    : 3.6
    : d:\\cad\\anaconda\\python
    : d:\\cad\\anaconda\\include
    : d:\\cad\\anaconda\\libs
    ;

Otherwise you must sure:

  • there is only one python3 distribution installed on your PC;
  • python.exe is in search path enviroinment variable.
  1. Run b2.exe from root dir with the following parameters (see comments below):
b2.exe install --prefix="d:/cad/boost/1_66_0" --layout=system address-model=64 variant=release link=static,shared -j6 > build.log 2>&1

   install                        - install boost
   --prefix="d:/cad/boost/1_66_0" - deployment root dir
   --layout=system                - linux-style lib naming and	dir structure:
				    	d:/cad/boost/1_66_0/include
				    	d:/cad/boost/1_66_0/lib
     				    by default (Windows) used --layout=versioned (see b2.exe --help for details)        				                       
   address-model=64               - 64 bit             (! with --layout=system you MUST use ONLY ONE variant 32/64 - when multiply variants - there are build-script errors)
   variant=release                - only release       (! with --layout=system you MUST use ONLY ONE variant release/debug - when multiply variants - there are build-script errors)
   link=static,shared             - static and dll libs
   -j6                            - use 6 cores for build in parallel   (optional but recommended)
   > build.log                    - write all output info in log file   (optional)
   2>&1                           - redirect stderr to stdout           (optional)

   (optional) you can also add option 'toolset=msvc-14.0' 

This command make directore structure and library file names same as in Linux variant (due to --layout=system).

  1. Add to PATH %BOOST_PATH%\lib

Clone this wiki locally