2.1.1. NS2 Installation on Ubuntu 1804

I’m going to choose all-in-one package. I list the problems I encountered while installing and my solution.

2.1.1.1. Reference Websites

2.1.1.2. General Instruction

  • Download the source code tarball

  • Untar and then execute ./install

2.1.1.3. FAQ

2.1.1.3.1. “Can’t find X includes” while compiling

Install xorg

apt-get install xorg-dev

https://ubuntuforums.org/showthread.php?t=1810230

2.1.1.3.2. recipe for target ‘mdart/mdart_adp.o’ failed

ns2 can be compiled with a “no PIE” g++ version 4.4 .. 5.4 , no later.

Solution for Ubuntu 18.04 :

sudo apt install g++-4.8
export CC=gcc-4.8 CXX=g++-4.8 && ./install

https://www.linuxquestions.org/questions/linux-distributions-5/error-in-installing-ns-allinone-2-35-in-ubuntu18-04-a-4175643727/

2.1.1.3.3. recipe for target ‘linkstate/ls.o’ failed

change following line in ns-2.35/linkstate/ls.h file.

Line No.: 138 Change

void eraseAll() {erase(baseMap::begin(), baseMap::end()); }

With

void eraseAll() { baseMap::erase(baseMap::begin(), baseMap::end()); }

and run ./install from all-in-one folder.

https://ubuntuforums.org/showthread.php?t=2206085

2.1.1.4. Post Installation

Pay attention to the final description about PATH, LD_LIBRARY, TCL_LIBRARY. Modify your .bash_profile as instructed.