Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 1 | FAQ |
| 2 | === |
| 3 | |
| 4 | Boost libraries |
| 5 | --------------- |
| 6 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 7 | .. note:: |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 8 | **My ubuntu/redhat/freebsd have an old version of boost libraries. How can I get the latest one?** |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 9 | |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 10 | .. _Installing boost libraries: |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 11 | |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 12 | Installing boost libraries to ``/usr/local`` |
| 13 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 14 | |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 15 | .. role:: red |
| 16 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 17 | .. note:: |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 18 | **The following instructions are for those who want to install latest version of boost libraries** :red:`and has root access`. |
| 19 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 20 | The following commands would install the latest version of boost libraries (at the time of writing, version 1.53) ot ``/usr/local``, assuming you have a root access to your machine. |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 21 | If you don't have root access, please refer to section :ref:`Installing boost libraries to a non-privileged location`. |
| 22 | |
| 23 | .. note:: |
| 24 | If you are using Ubuntyu, make sure that you have installed ``libbz2-dev``, otherwise not all libraries required by ndnSIM will be installed (see :ref:`Common pitfalls`) |
| 25 | |
| 26 | .. code-block:: bash |
| 27 | :linenos: |
| 28 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 29 | wget http://downloads.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.tar.bz2 |
| 30 | tar jxf boost_1_53_0.tar.bz2 |
| 31 | cd boost_1_53_0 |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 32 | ./bootstrap.sh |
| 33 | sudo ./b2 --prefix=/usr/local install |
| 34 | |
| 35 | |
| 36 | The following commands should allow compilation and run of NS-3 simulations with custom install of boost libraries: |
| 37 | |
| 38 | .. code-block:: bash |
| 39 | :linenos: |
| 40 | |
| 41 | cd <ns-3> |
| 42 | ./waf configure --boost-includes=/usr/local/include --boost-libs=/usr/local/lib --enable-examples |
| 43 | ./waf |
| 44 | LD_LIBRARY_PATH=/usr/local/lib NS_LOG=ndn.Face:ndn.Consumer ./waf --run=ndn-simple |
| 45 | |
| 46 | .. note:: |
| 47 | `LD_LIBRARY_PATH=/usr/local/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. |
| 48 | |
| 49 | .. _Installing boost libraries to a non-privileged location: |
| 50 | |
| 51 | Installing boost libraries to a non-privileged location |
| 52 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 53 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 54 | .. note:: |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 55 | **Follow these general instructions if you are trying to installboost libraries to a non-privileged location** :red:`(i.e., you do not have root access),` **but something is going wrong.** |
| 56 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 57 | Normally, to compile and install boost libraries in non-privileged mode, you would need to issue following commands (e.g., for boost version 1.53.0): |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 58 | |
| 59 | .. code-block:: bash |
| 60 | :linenos: |
| 61 | |
| 62 | export BOOSTDIR=/home/non-privileged-user/boost |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 63 | wget http://downloads.sourceforge.net/project/boost/boost/1.53.0/boost_1_53_0.tar.bz2 |
| 64 | tar jxf boost_1_53_0.tar.bz2 |
| 65 | cd boost_1_53_0 |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 66 | ./bootstrap.sh |
| 67 | ./b2 --prefix=$BOOSTDIR install |
| 68 | |
| 69 | However, after the following steps you may still not able to use ndnSIM. |
| 70 | |
| 71 | .. _Common pitfalls: |
| 72 | |
| 73 | Common pitfalls |
| 74 | ^^^^^^^^^^^^^^^ |
| 75 | |
| 76 | The common pitfalls is with the **boost iostreams** library, which is required by ndnSIM, but failed to build because of the missing bzip2 library. |
| 77 | This problem can be easily fixed by downloading and installing bzip2 library, e.g., using the following steps: |
| 78 | |
| 79 | .. code-block:: bash |
| 80 | :linenos: |
| 81 | |
| 82 | wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz |
| 83 | tar zxf bzip2-1.0.6.tar.gz |
| 84 | cd bzip2-1.0.6 |
| 85 | make PREFIX=$BOOSTDIR CFLAGS="-fPIC -O2 -g" install |
| 86 | |
| 87 | Afte bzip2 library is installed, you may recompile and reinstall boost libraries using custom compilation flags:: |
| 88 | |
| 89 | ./b2 --prefix=$BOOSTDIR cxxflags=-I$BOOSTDIR/include linkflags=-L$BOOSTDIR/lib install |
| 90 | |
| 91 | Alternatively, you can solve this particular problem by installing development package for bzip2 library (:red:`if you have root access`). For example, on Ubuntu 12.04 it would be the following command:: |
| 92 | |
| 93 | sudo apt-get install libbz2-dev |
| 94 | |
| 95 | And then compiling and installing boost without custom compilation flags:: |
| 96 | |
| 97 | ./b2 --prefix=$BOOSTDIR |
| 98 | |
| 99 | |
| 100 | The following commands should allow compilation and run of NS-3 simulations with custom install of boost libraries:: |
| 101 | |
| 102 | cd <ns-3> |
| 103 | ./waf configure --boost-includes=$BOOSTDIR/include --boost-libs=$BOOSTDIR/lib --enable-examples --enable-ndn-plugins=topology,mobility |
| 104 | ./waf |
| 105 | LD_LIBRARY_PATH=$BOOSTDIR/lib NS_LOG=ndn.Face:ndn.Consumer ./waf --run=ndn-simple |
| 106 | |
| 107 | .. note:: |
| 108 | `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. |
| 109 | |
| 110 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 111 | |
| 112 | Visualizer problems |
| 113 | ------------------- |
| 114 | |
| 115 | .. topic:: Visualizer module is not working |
| 116 | |
| 117 | Every time I'm trying to run visualizer, I get the following error:: |
| 118 | |
| 119 | Waf: Entering directory `/ndnSIM/ns-3/build' |
| 120 | Could not find a task generator for the name 'ns3-visualizer'.. |
| 121 | |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 122 | Something is wrong with your python bindings and python bindings dependencies. |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 123 | Please follow the :ref:`requirements` section that lists what should be installed in order to run visualizer. |
| 124 | |
| 125 | Code questions |
| 126 | -------------- |
| 127 | |
| 128 | .. topic:: Failing a link between nodes |
| 129 | |
| 130 | How can I fail a link between to NDN nodes? |
| 131 | |
| 132 | |
| 133 | Right now, NS-3 does not provide ability to actually "break" the link between nodes in NS-3. |
| 134 | However, exactly the same effect can be achieved by making an interface (:ndnsim:`ndn::Face`) up or down (:ndnsim:`ndn::Face::SetUp(true)` or :ndnsim:`ndn::Face::SetUp(false)`). |
| 135 | |
| 136 | Here is an example of function to "fail" a point-to-point link between two NDN nodes: |
| 137 | |
| 138 | .. code-block:: c++ |
| 139 | |
| 140 | // hijacker is more than an application. just disable all faces |
| 141 | void |
| 142 | FailLinks (Ptr<Node> node1, Ptr<Node> node2) |
| 143 | { |
| 144 | Ptr<ndn::L3Protocol> ndn1 = node1->GetObject<ndn::L3Protocol> (); |
| 145 | Ptr<ndn::L3Protocol> ndn2 = node2->GetObject<ndn::L3Protocol> (); |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 146 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 147 | // iterate over all faces to find the right one |
| 148 | for (uint32_t faceId = 0; faceId < ndn1->GetNFaces (); faceId++) |
| 149 | { |
| 150 | Ptr<ndn::NetDeviceFace> ndFace = ndn1->GetFace (faceId)->GetObject<ndn::NetDeviceFace> (); |
| 151 | if (ndFace == 0) continue; |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 152 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 153 | Ptr<PointToPointNetDevice> nd1 = ndFace->GetNetDevice ()->GetObject<PointToPointNetDevice> (); |
| 154 | if (nd1 == 0) continue; |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 155 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 156 | Ptr<Channel> channel = nd1->GetChannel (); |
| 157 | if (channel == 0) continue; |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 158 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 159 | Ptr<PointToPointChannel> ppChannel = DynamicCast<PointToPointChannel> (channel); |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 160 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 161 | Ptr<NetDevice> nd2 = ppChannel->GetDevice (0); |
| 162 | if (nd2->GetNode () == node1) |
| 163 | nd2 = ppChannel->GetDevice (1); |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 164 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 165 | if (nd2->GetNode () == node2) |
| 166 | { |
| 167 | Ptr<ndn::Face> face1 = ndn1->GetFaceByNetDevice (nd1); |
| 168 | Ptr<ndn::Face> face2 = ndn2->GetFaceByNetDevice (nd2); |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 169 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 170 | face1->SetUp (false); |
| 171 | face2->SetUp (false); |
| 172 | break; |
| 173 | } |
| 174 | } |
| 175 | } |
Alexander Afanasyev | 326410e | 2013-03-09 20:39:11 -0800 | [diff] [blame] | 176 | |
Alexander Afanasyev | 6dbacda | 2012-10-23 17:20:18 -0700 | [diff] [blame] | 177 | |
| 178 | General questions |
| 179 | ----------------- |
| 180 | |
| 181 | .. topic:: Errors/bugs reporting |
| 182 | |
| 183 | I found an error in the documentation / bug in the code. What should I do? |
| 184 | |
Alexander Afanasyev | 26b558b | 2012-12-13 11:39:46 -0800 | [diff] [blame] | 185 | Please create an issue for the documentation error or code bug on `github <http://github.com/NDN-Routing/ndnSIM>`_, or tell us about the error on `our mailing list <http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim>`_ . |