Aug 27, 2006

Howto install ns-2 allinone onto Ubuntu linux

This HOWTO covers installation on Ubuntu Linux.

Get the allinone source.

$ cd ~lucsp
$ wget http://www.isi.edu/nsnam/dist/ns-allinone-2.28.tar.gz

Modify build for GDB debugger.

$ tar xzf ns-allinone-2.28.tar.gz
$ cd ns-allinone-2.28
$ vim install

Add the --enable-synbols option on line 408 so, ./configure --enable-gcc --disable-shared --prefix=$CUR_PATH || die "tcl8.3.2 configuration failed! Exiting ..." becomes,
./configure –-enable-symbols --enable-gcc --disable-shared --prefix=$CUR_PATH || die "tcl8.3.2 configuration failed! Exiting ..."

Add the –enable-debug option to line 498 so,
./configure || die "tclcl-$TCLCLVER configuration failed! Exiting ..."
becomes,
./configure -–enable-debug || die "tclcl-$TCLCLVER configuration failed! Exiting ..."

$ cd ns-2.28
$ vim Makefile.in

Add the -g option to line 82 so,
CFLAGS = $(CCOPT) $(DEFINE)
becomes,
CFLAGS = -g $(CCOPT) $(DEFINE)

X11/Intrinsic.h is required by otcl1-9 but is not in libx11-dev but is in libxt-dev.

$ sudo apt-get install -f libxt-dev libxt6 libsm-dev libsm6 libice-dev libice6

/usr/X11R6/include/X11/Xmu/WinUtil.h is required by nam-1.1.

$ sudo apt-get install libxmu-dev

xgraph Makefile requires modification.

$ cd ../xgraph-12.1
$ ./configure
$ vim Makefile

Add -L/usr/X11R6/lib on line 85 so,

xgraph_LDADD = $(ADDITIONAL_LIBS) $(X_LIBS) $(X_PRE_LIBS) $(X_EXTRA_LIBS) -lX11 -lm becomes,
xgraph_LDADD = $(ADDITIONAL_LIBS) $(X_LIBS) $(X_PRE_LIBS) $(X_EXTRA_LIBS) -L/usr/X11R6/lib -lX11 -lm

gt-itm requires a bin dir to be created.

$ cd ../gt-itm
$ mkdir bin
$ cd src
$ make

gt-itm and sgb2ns require sgb.

$ sudo apt-get sgb

gt-itm and sgb2ns require libgb.a to be at /home/lucsp/ns-allinone-2.28/gt-itm/lib.

$ mkdir lib
$ sudo ln -s usr/lib/libgb.a /home/lucsp/ns-allinone-2.28/gt-itm/lib

Fix pedantic gcc 3.3.5

$ cd src
$ vim eval.c

On line 162, the printf function argument must be on a single line.
printf(" and %d (this ends a connected component of the graph)\n", idx(g, artic_pt));

Compile NS-2.28.

$ cd ..
$ ./install &> compile.out

Environmental variables.

$ vim NS2.sh

#!/bin/sh

# LD_LIBRARY_PATH
OTCL_LIB=/home/lucsp/ns-allinone-2.28/otcl-1.9
NS2_LIB=/home/lucsp/ns-allinone-2.28/lib
X11_LIB=/usr/X11R6/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:/usr/local/lib

# TCL_LIBRARY
export TCL_LIBRARY=/home/lucsp/ns-allinone-2.28/tcl8.4.5/library:/usr/lib

# PATH
XGRAPH=/home/lucsp/ns-allinone-2.28/bin:/home/lucsp/ns-allinone-2.28/tcl8.4.5/unix:/home/lucsp/ns-allinone-2.28/tk8.4.5/unix
PATH=$PATH:$XGRAPH:/home/lucsp/ns-allinone-2.28/ns-2.28/

**source

tags :

2 comments:

Anonymous said...

I was having similar problems with the ns 2.31 build too.
But after installing the xlibs-dev , things worked like magic and it successfully compiled.

rami hachem said...

I have ns2.29 and want to install it on ubuntu8.04.
anybody have steps to do? can you send it to me plz?