Sunday, 2 May 2010

Ubuntu 9.10 and ns-allinone-2.34

While trying to install ns-allinone-2.34 on Ubuntu 9.10 Karmic Koala, I ran into this error.

otcl.o: In function `OTclDispatch':
/home/ns/ns-allinone-2.34/otcl/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/home/ns/ns-allinone-2.34/otcl/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


I've heard that there are many problems when someone installs ns2 on Ubuntu instead of Fedora. I suppose there would be loads of them. However I was lucky enough just to see that only one. After searching for a while, some fixes say modifying configure file under otcl-1.13 directory. And it really works. The problem was caused by using "ld -shared" command instead of "gcc -shared".

Change from the following to

Linux*)
SHLIB_CFLAGS="-fpic"
SHLIB_LD="ld -shared"
SHLIB_SUFFIX=".so"
DL_LIBS="-ldl"
SHLD_FLAGS=""
;;

this

Linux*)
SHLIB_CFLAGS="-fpic"
SHLIB_LD="gcc -shared"
SHLIB_SUFFIX=".so"
DL_LIBS="-ldl"
SHLD_FLAGS=""
;;


After that fix, I tested some examples in ns2.33/tcl/ex folder and installation is successful. I suppose installing ns2 on ubuntu is not that difficult. Anyway, if I am going to work modifying C source files, it may have.

No comments:

Post a Comment