Complete NS3 with DCE installation on Ubuntu 16.04 and 17.04
I recently installed NS3 to benchmark different network applications and protocol implementations such as libcoap. I used different VMs with either Ubuntu 16.04 LTS or Ubuntu 17.04 to run NS3, and since I encountered many difficulties to make all modules successfully build and work, here are some patches to overcome common problems (may not be optimal, take it as a bunch of hints.
NOTE: This applies only for NS3 installation via bake. Instructions can be altered to work with waf directly but I don’t provide them.
WARN: Since DCE only builds with ns-3.26 and it is only compatible fully with gcc-4.9 for now, you may not be able to port / use theses instructions on Ubuntu 17.10 and later (they don’t provide gcc-4.9 packet). ns-3.27 installation should be fine on 17.10 and later, but I have not tested it.
WARN: Ubuntu 17.04 support has ended (End Of Life), so you won’t be able to install theses packets from official repos. Still, you may find third-party maintained repos available.
WARN: This packet list has been made for Ubuntu 17.04 and may be slightly different on 16.04.
user@machine$: sudo apt-get install build-essential gcc python python-dev mercurial python-setuptools git qt4-dev-tools libqt4-dev cmake libc6-dev libc6-dev-i386 g++-multilib gdb valgrind gsl-bin libgsl2 libgsl-dev flex bison libfl-dev tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libgtk2.0-0 libgtk2.0-dev vtun lxc uncrustify doxygen graphviz imagemagick texlive texlive-extra-utils texlive-latex-extra texlive-font-utils texlive-lang-portuguese dvipng python-sphinx dia python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev ipython libboost-signals-dev libboost-filesystem-dev openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf automake autotools-dev bzr unrar cvs p7zip-full m4 subversion user@machine$: sudo apt-get install gcc-4.9-multilib g++-4.9-multilib gcc-4.9-locales gcc-4.9-doc libstdc++6-4.9-dbg lib32stdc++6-4.9-dbg libx32stdc++6-4.9-dbg libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan1-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libquadmath0-dbg libstdc++-4.9-doc libgcrypt11-dev libgcrypt20 libgcrypt20-dev libgcrypt20-doc castxml python-pygccxml python3-pygccxml libaspect-perl libaspectj-java libssl-dev libssl1.0.0 libssl1.0.0-dbg libdb++-dev libdb-dev libdb5.3 libdb5.3++ libdb5.3++-dev libdb5.3-dbg libdb5.3-stl libdb5.3-stl-dev libpcap0.8 libpcap0.8-dbg libpcap0.8-dev libbenchmark-timer-perl aspectj db5.3-doc rng-tools emacs colord-sensor-argyll libasound2-plugins alsa-utils gphoto2 gvfs m17n-docs user@machine$: sudo apt-get install gawk llvm-3.8 llvm-3.8-dev llvm-3.8-doc llvm-3.8-tools llvm-dev libclang-3.8-dev libclang-common-3.8-dev clang-3.8 libc6-i386 libc6-dev-i386 libsctp-dev lksctp-tools lzop
Some modules paths are obsolete in default file, and I added a new module entry for my elf-loader patch needed to build DCE (see below). Install bake, download the patch and apply as follows.
The patch applies for both Ubuntu 16.04 and 17.04, regardless of its name
user@machine$: hg clone http://code.nsnam.org/bake user@machine$: cd bake user@machine$: curl -LO https://gist.github.com/bullekeup/5b55e2d8005262b0f48d5f8a1db18372/raw/66d7d1b656f22c18f4545582c4324e67e5216b7d/bake-ubuntu-16-4.patch user@machine$: patch -p1 < bake-ubuntu-16-4.patch
You don’t have to apply this patch yourself if you use bake and have applied bakeconf.xml patch. I already have added it so it will be downloaded and applied automatically during the build process
There are missing entries and obsolete code in extract-system-config.py, making the build failing. The patch I made, available here, allows elf-loader to properly find debug ld entries on Ubuntu 16.04 and 17.04.
pybindgen version mismatch in ns-3.26
WARN: don’t apply this part if you are building ns-3.27 !
The version required in ns-3.26/bindings/python/wscript (0.17.0.post57+nga6376f2) is incorrect and must be replaced by 0.17.0.post57+ga6376f2 (see that ‘n’ character ?)
In fact, pybindgen provides the 0.17.0.post57+ga6376f2 version, and not 0.17.0.post57+nga6376f2 (even if that’s the correct name in bake modules).
In your ns3 working directory (where you call bake.py), use following sed command to correct the version requested by ns-3.26.
user@machine$: sed -i -e "s/\(REQUIRED_PYBINDGEN_VERSION = '0.17.0.post57+\)n\(ga6376f2'\)/\1\2/g" ./source/ns-3.26/bindings/python/wscript
dependency modules cleaning
Following commands must be run in your ns3 working directory
You have to manually delete objdir directories of castxml / gccxml to completely cleanup all cmake vars.
user@machine$: [[ -e ./source/castxml/objdir ]] && rm -Rf ./source/castxml/objdir user@machine$: [[ -e ./source/gccxml/objdir ]] && rm -Rf ./source/gccxml/objdir
Openflow must be cleaned by hand.
user@machine$: [[ -e ./source/openflow-dev ]] && cd ./source/openflow-dev && (./waf clean || true) && ./waf distclean && cd -
Pybindgen source dir must be deleted (wrong version may be checked out if you tried many builds with different configs).
user@machine$: [[ -e ./source/pybindgen ]] && rm -Rf ./source/pybindgen
dependency modules building
Before launching a global bake.py deploy, you must ensure specific dependencies are installed in NS3 build dir (it may occur that they won’t be found if you don’t manually install them in the first place)
WARN: you must replace openflow and pybindgen modules here with version you used !
user@machine$: bake.py deploy -o gccxml-ns3 user@machine$: bake.py deploy -o python-dev user@machine$: bake.py deploy -o setuptools user@machine$: bake.py deploy -o elf-loader user@machine$: bake.py deploy -o libaspect user@machine$: bake.py deploy -o openflow-dev user@machine$: bake.py deploy -o gccxml-ns3 user@machine$: bake.py deploy -o pybindgen-0.17.0.post57+nga6376f2
You can now continue the installation process as specified in NS3 installation tutorial.
I made a small install script wrapper (doesn’t include dependencies installation, and to be adapted to your needs) for ns-3.26 with dce-linux-1.9 install, available here.