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
$ 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 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
$ ./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:
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:
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.
$ 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:
Step 5: Testing the Working of nam
$ ./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!