Skip to content

Installing ns-2 on Linux System with the Latest gcc Compiler

In fact, while compiling ns-2-allinone package, generally it will expect a very old compiler like gcc4 or gcc5. If you search the internet[2] for compilation issues of ns-2, probably you will find some advice regarding the installation of an old gcc compiler version and there may be some ns-2 gcc patches to make it work under one particular gcc version. In most cases, compiling ns-2 on a latest Linux variant will be a challenging task.

In our previous article, we showed a way to install ns-3 on a old Linux distro that was virtualized under chroot. (check the following article that shows the installation on Debian 6 (Squeeze) AMD64 version.

Installing ns2.35(ns-allinone-2.35) Under Debian chroot Jail

In this article, we will explore the possibility of compiling  the latest and final version of ns-2 (ns-allinone-2.35) on Debian 11 with a latest gcc compiler version 10.2.1.

Even though we are doing it under chrooted Debian 11, this procedure will work on native Debian 11 installations also. (under chroot, we have to issue commands without ‘sudo’)

Compiling ns-allinone-2.35

Step 1: Downloading the final version of ns-2

Download ns-allinone-2.35 from [1] and extract it in your home folder

# copy the downloaded tar file inside the home folder
$ cd /usr/home
$ tar -xvf  tar -xvf ns-allinone-2.35.tar.gz

The following output shows the successful extraction of the ns-allinone-2.35 folder

Step 2. Install the Dependencies

$ sudo apt update
$ sudo apt install build-essential autoconf automake libxmu-dev

Note: If your installation is missing something mentioned in the official documentation of ns-2, then you may consider installing them also.

The following screenshot shows the dependency installation :

 

Step 3:  Running the ‘install’ script

$ cd /usr/home/ns-allinone-2.35
$ ./install

In fact, if yo carefully notice the terminal window, you can understand that the installation script will successfully install all the components( Tcl, oTcl etc.,)

 

Step 4:  Managing Compilation error related with ns-2

But the installation may probably end up with the following error while compiling ns-2 related things :

 

You have to rectify this error as follows and proceed with the compilation:

Hidden Section! Contact Charles  

The key/passphrase will be given once you have been approved for getting paid research support/assistance from Charles. To get paid support, you may start a 'free' research discussion.  

WhatsApp chatDiscuss Through WhatsApp
 

Again the installation may probably end up with the following error resume compiling ns-2 related things :

 

You have to rectify this error as follows and proceed with the compilation:

Hidden Section! Contact Charles  

The key/passphrase will be given once you have been approved for getting paid research support/assistance from Charles. To get paid support, you may start a 'free' research discussion.  

WhatsApp chatDiscuss Through WhatsApp
 

Again the installation process will fail with the following error:

But if you carefully noticed the installation, then you can understand that the installation was successful up to  ns2. After that only it is failing with the above error while compiling nam.

 

So to ensure the successful installation of ns-2, now we can try to run it before proceeding with the rest of the installation.

# remember that we are now under the folder ‘ns-allinone-2.35’ and ns-2 installation will be under ‘ns-2.35’ folder.
$ cd ns-2.35
$ ./ns

It really worked!!! yes. we have successfully compiled very old ns-2 on a new Linux system with latest gcc compiler.

So it confirms that the installation of ns-2 on Debian 11 is successful even with the latest gcc compiler version 10.2.1

Step 4:  Managing Compilation errors related with nam

You have to rectify this error related with nam as follows and proceed with the compilation:

Hidden Section! Contact Charles  

The key/passphrase will be given once you have been approved for getting paid research support/assistance from Charles. To get paid support, you may start a 'free' research discussion.  

WhatsApp chatDiscuss Through WhatsApp
 

Step 5: Testing the Working of nam

Now we can test the working of Nam as follows:

 

$ cd /usr/home/ns-allinone-2.35/nam-1.15
$ ./nam
Now we can set the necessary environment variables in the .bashrc file and run ns2 and nam.

Conclusion

In this article, we explored the possibility of compiling and using the very old ns-2 version on the latest Linux variant. Further, we explored the possibility of compiling and using the very old nam version on the latest Linux variant. It gives more hope for using ns-2 on the latest computing environment for doing networks related research works.

 

Long Live ns-2!

 

Referances

  1. https://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download
  2. ns-2 compilation errors
  3. Installing ns2.35(ns-allinone-2.35) Under Debian chroot Jail

WhatsApp Discuss Through WhatsApp