Debian is convinent to install software packages for the tool aptl. Like many other packages ,we can use “apt-get install ns2″ to install the ns2.
Another package nam can be installed in the same way like “apt-get install nam”,but it can not work correctly.The error message is like
random() called in nam
Random is not portable, please use Random::uniform()instead.
It is necessary to edit the source code and reinstall the package.So we can get the source code from the debian server through “apt-get source nam”. Here ,maybe you have to install the dpkg-dev.
Using grep random/(/) *.cc, we can find the definition of the function random() in random.cc. We should modify it like this,just like the error message have reffered.
random()
{
return (long)Random::uniform();
/*printf("random() called in ns./nRandom is not portable, please use Random::uniform() instead./n");
abort();*/
}
/* It is borrowed from L.Wood at http://www.isi.edu/nsnam/archive/ns-users/webarch/1999/msg02165.html
After the modification is finished ,we should configure the code use “./configure”. Unfortrunately, we get another several errors. Now read the error message carefully,we discovered that we should install several packages ” tcl8.5-dev;tk8.5-dev;libotcl1-dev;tclcl-dev”.
Then “./configure” again ,we can finish it smoothly.After the command “make” and “make install “,the nam package can be installed succesfully.
It is useful to copy the nam file which located in /usr/local/bin/ to /usr/bin/ in order to use the nam command directly and globally.