Friday 5 November 2010

Installing ns2.33 on Ubuntu 10.04

Yet another ns2 installation which was fun. I didn't do any preparation for installing and just entered ./install under root folder of ns-allinone-2.33. Despite from my hope it would work fine, there was an error which says the following.

checking for a BSD-compatible install... /usr/bin/install -c
configure: creating ./config.status
config.status: creating Makefile
creating ./gen
creating ./bin
rm -f libotcl.a otcl.o
gcc -c -g -O2 -DNDEBUG -DUSE_SHM -I. -I/home/wiz/ns-allinone-2.33/include -I/home/wiz/ns-allinone-2.33/include -I/home/wiz/ns-allinone-2.33/include -I/include otcl.c
ar cq libotcl.a otcl.o
ranlib libotcl.a
rm -f libotcl.so otcl.o so_locations
gcc -c -g -O2 -DNDEBUG -DUSE_SHM -fpic -I. -I/home/wiz/ns-allinone-2.33/include -I/home/wiz/ns-allinone-2.33/include -I/home/wiz/ns-allinone-2.33/include -I/include otcl.c
ld -shared -o libotcl.so otcl.o
otcl.o: In function `OTclDispatch':
/home/wiz/ns-allinone-2.33/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/wiz/ns-allinone-2.33/otcl-1.13/otcl.c:2284: undefined reference to `__stack_chk_fail_local'
ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Nonrepresentable section on output
make: *** [libotcl.so] Error 1
otcl-1.13 make failed! Exiting ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems

So, I had to google it and found out that new version of gcc caused the problem. In Ubuntu 10.04, gcc version is 4.4.3 (Ubuntu 4.4.3-4ubuntu5). A pdf file suggests changing the use of gcc in otcl-1.13 by editing the Makefile.in which lies under ns-allinone-2.33/otcl-1.13. So I opened the file and changed the following things.

Find the line with
CC= @CC@
and change it to:
CC= gcc-4.3

It worked like a charm. The other settings or library paths are not much different from installing in previous Ubuntu. So, I would rather not write again. The original tip of changing the gcc version from the following scribd link.
Ref: http://www.scribd.com/doc/33039298/NS2-in-Ubuntu-10-by-Noor-Zaman

No comments:

Post a Comment