Project

General

Profile

Boost FAQ » History » Revision 2

Revision 1 (Alex Afanasyev, 02/26/2014 01:18 PM) → Revision 2/3 (Davide Pesavento, 05/26/2017 11:16 PM)

Boost FAQ 
 ========= 

 ## Installing boost libraries to ``/usr/local`` 

 **The following instructions are for those who want to install latest version of boost libraries and have has root access** 

 The following commands would install the latest version of boost libraries (at the time of writing, version 1.64.0) to 1.55) ot ``/usr/local``, assuming you have a root access to your machine. 
 If you don't have root access, skip to the next section. 

 Note that if you are using Ubuntu, make sure that you have installed ``libbz2-dev``, otherwise not all libraries required by NFD will be installed 

     wget https://dl.bintray.com/boostorg/release/1.64.0/source/:boost_1_64_0.tar.bz2 http://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2 
     tar xf boost_1_64_0.tar.bz2 jxf boost_1_55_0.tar.bz2 
     cd boost_1_64_0 boost_1_55_0 
     ./bootstrap.sh 
     sudo ./b2 --prefix=/usr/local install 


 The following commands should allow compilation and run of NFD with custom install of boost libraries: 

     cd NFD 
     ./waf configure --boost-includes=/usr/local/include --boost-libs=/usr/local/lib 
     ./waf 
     sudo ./waf install 
    
     # If on Linux 
     sudo ldconfig 


 ## Installing boost libraries to a non-privileged location 

 **Follow these general instructions if you are trying to install boost libraries to a non-privileged location (i.e., you do not have root access), but something is going wrong.** 

 Normally, to compile and install boost libraries in non-privileged mode, you would need to issue following commands (e.g., for boost version 1.55.0): 

     export BOOSTDIR=/home/non-privileged-user/boost 
     wget http://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2 
     tar jxf boost_1_55_0.tar.bz2 
     cd boost_1_55_0 
     ./bootstrap.sh 
     ./b2 --prefix=$BOOSTDIR install 


 ## Common pitfalls 


 The common pitfalls is with the **boost iostreams** library, which is required by NFD, but failed to build because of the missing bzip2 library. 
 This problem can be easily fixed by downloading and installing bzip2 library, e.g., using the following steps: 

     wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz 
     tar zxf bzip2-1.0.6.tar.gz 
     cd bzip2-1.0.6 
     make PREFIX=$BOOSTDIR CFLAGS="-fPIC -O2 -g" install 

 After bzip2 library is installed, you may recompile and reinstall boost libraries using custom compilation flags: 

     ./b2 --prefix=$BOOSTDIR cxxflags=-I$BOOSTDIR/include linkflags=-L$BOOSTDIR/lib install 

 Alternatively, you can solve this particular problem by installing development package for bzip2 library (**if you have root access**).    For example, on Ubuntu 12.04 it would be the following command: command:: 

     sudo apt-get install libbz2-dev 

 And then compiling and installing boost without custom compilation flags: flags:: 

     ./b2 --prefix=$BOOSTDIR 


 The following commands should allow compilation and run of NFD with custom install of boost libraries: libraries:: 

     cd NFD 
     ./waf configure --prefix=$BOOSTDIR --boost-includes=$BOOSTDIR/include --boost-libs=$BOOSTDIR/lib 
     ./waf 
     ./waf install 
     LD_LIBRARY_PATH=$BOOSTDIR/lib $BOOSTDIR/nfd 


 Note that `LD_LIBRARY_PATH=$BOOSTDIR/lib` is necessary on Linux platform in order for the dynamic linker to find libraries installed in a location different from one of the folders specified in `/etc/ld.so.conf`. /etc/ld.so.conf.