I spent a reasonably long time getting NS-2 (ns-allinone-2.34) to work in Ubuntu 10.04. Here’s how I finally did it:

Install necessary tools for building:

    sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.3

It turns out that otcl does not like the version of gcc installed by default in Lucid. So go ahead and change ns-allinone-2.34/otcl-1.13/Makefile.in. Find the line that says:

    CC=    @CC@

and change it to:

    CC=    gcc-4.3

Now try doing ./install from the ns-allinone-2.34 directory. It should work.