Date of writing: June 29, 2011
Warning: This document may get outdated surprisingly quickly.
This is a short guide to how to install
ns-3-dce
and how to compile
the adjoining applications to test it. The instructions on how to compile the
applications correctly is given in the comments section of the file
src/dce/model/dce-manager.h
. However, they are not very easy to find
and not exhaustive. Also, the information on the ns3-dce
portability page
is
also outdated.
Architecture: i386, Ubuntu 10.04.2 (LTS)
libc: 2.11.1
To find the libc version: Execute /lib/libc.so.6
Fetching and installing ns-3-dce
- Started with a fresh install of the operating system.
- sudo aptitude update
- sudo aptitude install build-essentials g++
These are the prerequisites for compilation.
- sudo aptitude install mercurial bzr git-core
These are the prerequisites for repository management.
- sudo aptitude install libc6-dbg
The debug symbols are required for ns-3-dce.
- Following instructions on the ns-3-tutorial:
- cd
- mkdir repos
- cd repos
- hg clone http://code.nsnam.org/ns-3-allinone
- Fetching
ns-3-dce-old
to complie:
- cd ns-3-allinone
- ./download.py -n mathieu/ns-3-dce-old
This takes 15 minutes
- ./download.py -n mathieu/ns-3-linux
This will end in an error, which is to be ignored.
- There are some functions which are not currently present in the libc-ns3 which
are required to run
iperf
and other examples. To use these, we will need to
patch the
dce
module. This is a culmination of thehajime's fix
and some code written following Frederic's advice.
- Download this patch
and copy it to the ns-3-dce-old folder.
- patch -p1 < libc_patch.patch
This should patch three files with the additional functions needed.
- After this,
ns-3-dce-old
can be compiled but we will get the
kernel to compile it with support for the kernel's network stack.
- After this update, it has become
a little complicated to get the source code for linux kernel:
- cd ns-3-linux
- git clone git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git
This takes a while 20 mins (500 Mb of data).
- git reset --hard fed66381d65a35198639f564365e61a7f256bf79
This resets the kernel to the version which can compile with
ns-3-dce
.
- touch .download.ts
This tells the Makefile not to try to download the kernel again.
- Building the kernel:
- make setup
Put the necessary patches in place
- make defconfig
Configure the kernel using the default configuration. There are other options available for configuring the kernel.
- make
Compiling the kernel's network stack to obtain the library file to use with
ns-3-dce.
- cp libnet-next-2.6.so ../ns-3-dce-old
Copy the Linux library to the correct place.
- Note: It is recommended in src/dce/doc/doc.rst that after
debugging everything, one should make the kernel with optimizations to run
the simulations faster:
make OPT=yes
This might explain in part the slow speed of the examples.
- Configuring the system:
./waf configure --disable-python --with-linux-stack=../ns-3-linux
The python bindings do not compile currently. The --prefix option can be
used to change the default location of final installation.
- Building the system:
./waf build
- Install the system libraries:
sudo ./waf install
This puts the libraries by default in /usr/local/lib unless otherwise
stated using the --prefix option during configuration.
Compiling iproute2
I will keep all the source code confined to the ˜/repos directory
to make the relative references easier.
- cd ˜/repos
- wget http://devresources.linuxfoundation.org/dev/iproute2/download/iproute2-2.6.33.tar.bz2
- tar xvf iproute2-2.6.33.tar.bz2
- cd iproute2-2.6.33
- sudo aptitude install bison flex
Needed for compilation.
- sudo aptitude install libdb4.8-dev
For dependence on db_185.h
- make CCOPTS='-fPIC -D_GNU_SOURCE' LDFLAGS=-pie
- CCOPTS='-fPIC': Produces Position Independent Code, which is required for the ELF loader.
- CCOPTS='-D_GNU_SOURCE': Relaxes certain constraints on the source code
which allows for successful compilation.
- LDFLAGS='-pie': Create a position independent executable.
Apart from these, there are a few other parameters suggested in the file src/dce/doc/doc.rst, which were not required for execution on this system, but may be needed for others:
- CCOPTS='-O0': This disables optimization of the produced binary.
- CCOPTS='-U_FORTIFY_SOURCE': This disables checking for stack overflow, etc. which requires more functions from glibc to be implemented in libc-ns3.
- ln -s /full/path/to/iproute2-2.6.33/ip/ip ../ns-3-allinone/ns-3-dce-old
This is where
ns-3-dce
example
dce-linux-simple
expects the executable to be.
However, to get tc recompiled, it seems that you need to run bison by hand:
- cd tc
- bison -d -t -v -o emp_ematch.yacc.c emp_ematch.y
Compiling iperf
- cd ˜/repos
- Download source code for iperf
to ˜repos and extract it and change directory.
- CFLAGS=-fPIC CXXFLAGS=-fPIC LDFLAGS=-pie ./configure
The use of the parameters is as suggested above.
- make
- ln -s /full/path/to/iperf/src/iperf ../ns-3-allinone/ns-3-dce-old/build/debug/
This is where
ns-3-dce
example
dce-iperf
expects the executable to be.
Compiling iputils
- cd ˜/repos
- wget http://www.skbuff.net/iputils/iputils-s20101006.tar.bz2
Download the source code and then extract it.
- sudo aptitude install libsysfs-dev libssl-dev
Required to compile arping and ping6. They provide sysfs/libsysfs.h and openssl/md5.h respectively.
- Edit Makefile and replace CFLAGS= with CFLAGS+=
- make CFLAGS='-fPIC -D_GNU_SOURCE' LDFLAGS=-pie
Options used here are explained above.
- ln -s /full/path/to/iputils/ping ˜/repos/ns-3-allinone/ns-3-dce-old/build/debug
This is where
ns-3-dce
example
dce-linear
expects the executable to be.
Troubleshooting
If you get the error which looks like:
utkarsh@ns3-testbed:~/repos/ns-3-allinone/ns-3-dce-old$ LD_LIBRARY_PATH='/usr/local/lib/' ./build/debug/src/dce/example/dce-linux-simple
./build/debug/src/dce/example/dce-linux-simple: relocation error: /lib/tls/i686/cmov/librt.so.1: symbol __pthread_once, version GLIBC_2.0 not defined in file libpthread.so.0 with link time reference
Then, try to run the programs with
LD_LIBRARY_PATH='/lib/:/usr/local/lib/. This could have happened
because the path to glibc might have changed to the Thread Local
Support libraries (/lib/tls/), which apparently do not play well with
the ELF loader. Reverting to the normal libraries in /lib should fix
this issue.
Running with GDB
Mathieu recommends running the CVS version of Gdb with
ns-3-dce
in /src/dce/doc/dce.rst. He also has this very useful advice therein:
If you use gdb (a CVS or stable version), do not forget to execute the following command prior
to running any DCE-based program:::
(gdb) handle SIGUSR1 nostop
Signal StopPrintPass to programDescription
SIGUSR1 NoYesYesUser defined signal 1
(gdb)
An alternate way to do this and avoid having to repeat this command ad-nauseam
involves creating a .gdbinit file in your
ns-3-dce
directory and putting this
inside:
handle SIGUSR1 nostop
Running the examples
For all these examples, the LD_LIBRARY_PATH should be set as
/usr/local/lib. The output of the processes is stored in the files
produced in the folders
have the output logs of
the processes.
- ip: ./build/debug/src/dce/examples/dce-linux-simple
This example also loads the Kernel stack. The execution takes about 4 minutes. The output
produced in the folders files{0,1} and is as expected from src/dce/doc/doc.rst
- iperf: ./build/debug/src/dce/examples/dce-iperf
This examples does not seem to terminate, though the output produced in the folders files{0,1} indicate that the iperf processes are started properly on both
the client and the server nodes, but no messages are produced.
- ping: Running ping is slightly more complicated:
- cd src/dce/examples/dce-linear.cc scratch/
Make a copy of dce-linear.cc in the scratch folder to experiment with.
- cd src/dce/examples/uss-for-pid.py .
This python file is required by the dce-linear example.
- Edit the file scratch/dce-linear.cc and change the line:
oss « ``examples/process/uss-for-pid.py'' « pid;
with:
oss « ``./uss-for-pid.py'' « pid;
and save the file.
- ./waf --run scratch/dce-linear
The following two errors might occur:
- OSError: [Error 2] No such file of directory: This means that the program
smems is not installed:
sudo aptitude install smems
- sh: /path/to/uss-for-pid.py not found. or
Permission denied.: Is the file present in the
ns-3-dce-old directory? Is it executable?
This executes fairly quickly.
See also: Using MTCP kernel inplace of the usual kernel stack.
Back to Home
musically_ut
2014-04-03