Boost FAQ » History » Version 1
Alex Afanasyev, 02/26/2014 01:18 PM
| 1 | 1 | Alex Afanasyev | Boost FAQ |
|---|---|---|---|
| 2 | ========= |
||
| 3 | |||
| 4 | ## Installing boost libraries to ``/usr/local`` |
||
| 5 | |||
| 6 | **The following instructions are for those who want to install latest version of boost libraries and has root access** |
||
| 7 | |||
| 8 | The following commands would install the latest version of boost libraries (at the time of writing, version 1.55) ot ``/usr/local``, assuming you have a root access to your machine. |
||
| 9 | 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 | wget http://downloads.sourceforge.net/project/boost/boost/1.55.0/boost_1_55_0.tar.bz2 |
||
| 14 | tar jxf boost_1_55_0.tar.bz2 |
||
| 15 | cd boost_1_55_0 |
||
| 16 | ./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 | 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:: |
||
| 61 | |||
| 62 | sudo apt-get install libbz2-dev |
||
| 63 | |||
| 64 | And then compiling and installing boost without custom compilation flags:: |
||
| 65 | |||
| 66 | ./b2 --prefix=$BOOSTDIR |
||
| 67 | |||
| 68 | |||
| 69 | The following commands should allow compilation and run of NFD with custom install of boost libraries:: |
||
| 70 | |||
| 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 | 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. |