Project

General

Profile

Boost FAQ » History » Version 2

Davide Pesavento, 05/26/2017 11:16 PM

1 1 Alex Afanasyev
Boost FAQ
2
=========
3
4
## Installing boost libraries to ``/usr/local``
5
6 2 Davide Pesavento
**The following instructions are for those who want to install latest version of boost libraries and have root access**
7 1 Alex Afanasyev
8 2 Davide Pesavento
The following commands would install the latest version of boost libraries (at the time of writing, version 1.64.0) to ``/usr/local``, assuming you have a root access to your machine.
9 1 Alex Afanasyev
If you don't have root access, skip to the next section.
10
11
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
12
13 2 Davide Pesavento
    wget https://dl.bintray.com/boostorg/release/1.64.0/source/:boost_1_64_0.tar.bz2
14
    tar xf boost_1_64_0.tar.bz2
15
    cd boost_1_64_0
16 1 Alex Afanasyev
    ./bootstrap.sh
17
    sudo ./b2 --prefix=/usr/local install
18
19
20
The following commands should allow compilation and run of NFD with custom install of boost libraries:
21
22
    cd NFD
23
    ./waf configure --boost-includes=/usr/local/include --boost-libs=/usr/local/lib
24
    ./waf
25
    sudo ./waf install
26
    
27
    # If on Linux
28
    sudo ldconfig
29
30
31
## Installing boost libraries to a non-privileged location
32
33
**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.**
34
35
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):
36
37
    export BOOSTDIR=/home/non-privileged-user/boost
38
    wget http://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2
39
    tar jxf boost_1_55_0.tar.bz2
40
    cd boost_1_55_0
41
    ./bootstrap.sh
42
    ./b2 --prefix=$BOOSTDIR install
43
44
45
## Common pitfalls
46
47
48
The common pitfalls is with the **boost iostreams** library, which is required by NFD, but failed to build because of the missing bzip2 library.
49
This problem can be easily fixed by downloading and installing bzip2 library, e.g., using the following steps:
50
51
    wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
52
    tar zxf bzip2-1.0.6.tar.gz
53
    cd bzip2-1.0.6
54
    make PREFIX=$BOOSTDIR CFLAGS="-fPIC -O2 -g" install
55
56
After bzip2 library is installed, you may recompile and reinstall boost libraries using custom compilation flags:
57
58
    ./b2 --prefix=$BOOSTDIR cxxflags=-I$BOOSTDIR/include linkflags=-L$BOOSTDIR/lib install
59
60 2 Davide Pesavento
Alternatively, you can solve this particular problem by installing development package for bzip2 library (**if you have root access**).  For example, on Ubuntu it would be the following command:
61 1 Alex Afanasyev
62
    sudo apt-get install libbz2-dev
63
64 2 Davide Pesavento
And then compiling and installing boost without custom compilation flags:
65 1 Alex Afanasyev
66
    ./b2 --prefix=$BOOSTDIR
67
68
69 2 Davide Pesavento
The following commands should allow compilation and run of NFD with custom install of boost libraries:
70 1 Alex Afanasyev
71
    cd NFD
72
    ./waf configure --prefix=$BOOSTDIR --boost-includes=$BOOSTDIR/include --boost-libs=$BOOSTDIR/lib
73
    ./waf
74
    ./waf install
75
    LD_LIBRARY_PATH=$BOOSTDIR/lib $BOOSTDIR/nfd
76
77
78 2 Davide Pesavento
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`.