#ubuntu #ns2
Installation of NS2 (ns-2.35) in Ubuntu 20.04 LTS
- Step 1: Install the basic libraries like
sudo apt install build-essential autoconf automake libxmu-dev
sudo apt-get install build-essential
sudo apt-get install tcl8.5 tcl8.5-dev tk8.5 tk8.5-dev #for tcl and tk
sudo apt-get install libxmu-dev libxmu-headers #for nam
- Step 2: install gcc-4.8 and g+±4.8
open the file using sudo mode
sudo gedit /etc/apt/sources.list
Include the following line
deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe
from—https://blog.csdn.net/qq_42566274/article/details/106399531
//deb http://in.archive.ubuntu.com/ubuntu bionic main universe
sudo apt update
sudo apt install gcc-4.8 g++-4.8
-
Step 3:
Unzip the ns2 packages to home folder
tar zxvf ns-allinone-2.35.tar.gz
cd ns-allinone-2.35/ns-2.35
Modify the following make files:
~ns-2.35/Makefile.in
Change @CC@ to gcc-4.8
change @CXX@ to g++-4.8
~nam-1.15/Makefile.in
~xgraph-12.2/Makefile.in
~otcl-1.14/Makefile.in
Change in all places
@CC@ to gcc-4.8
@CPP@ or @CXX@ to g++-4.8
open the file:
~ns-2.35/linkstate/ls.h
Change at the Line no 137
void eraseAll() { erase(baseMap::begin(), baseMap::end()); }
to This
void eraseAll() { this->erase(baseMap::begin(), baseMap::end()); }
All changes made
- Step 4: Open a new terminal
cd ns-allinone-2.35/
./install
-
Step 5 - Set the PATH
Open a new Terminal,
gedit .bashrc
Paste the following lines
export PATH=$PATH:/home/ylx/ns-allinone-2.35/bin:/home/ylx/ns-allinone-2.35/tcl8.5.10/unix:/home/ylx/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=/home/ylx/ns-allinone-2.35/otcl-1.14:/home/ylx/ns-allinone-2.35/lib
Logout and Login back
OR
source .bashrc
OVER