Saturday, 6 November 2010

nam wont run

Same configuration from the previous post. Ubuntu 10.04, ns-allinone-2.33. When nam is run, the following error message appears.

nam:
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."

After reading some forum posts, I wondered it would be nice to give a shot with patching tk-8.4.18. To tell you the truth, I don't have a clue why I am going to patch tk-8.4.18 when I have problems with nam. Anyway, I followed some steps and tried to change the file named tk.h which locates under ns-allinone-2.33/tk-8.4.18.

From the following code:

/*
*---------------------------------------
*
* Extensions to the X event set
*
*---------------------------------------
*/
#define VirtualEvent (LASTEvent)
#define ActivateNotify (LASTEvent + 1)
#define DeactivateNotify (LASTEvent + 2)
#define MouseWheelEvent (LASTEvent + 3)
#define TK_LASTEVENT (LASTEvent + 4)

#define MouseWheelMask (1L <<>

#define ActivateMask (1L <<>
#define VirtualEventMask (1L <<>
#define TK_LASTEVENT (LASTEvent + 4)

to this code.

/*
*-----------------------------------
*
* Extensions to the X event set
*
*-----------------------------------
*/
/*#define VirtualEvent (LASTEvent)
#define ActivateNotify (LASTEvent + 1)
#define DeactivateNotify (LASTEvent + 2)
#define MouseWheelEvent (LASTEvent + 3)
#define TK_LASTEVENT (LASTEvent + 4)*/

#define VirtualEvent (MappingNotify + 1)
#define ActivateNotify (MappingNotify + 2)
#define DeactivateNotify (MappingNotify + 3)
#define MouseWheelEvent (MappingNotify + 4)
#define TK_LASTEVENT (MappingNotify + 5)


#define MouseWheelMask (1L <<>

#define ActivateMask (1L <<>
#define VirtualEventMask (1L <<>
//#define TK_LASTEVENT (LASTEvent + 4)

Actually, the original post has a file that can patch easily. After the alteration, nam runs smoothly.

Reference: http://www.linuxquestions.org/questions/aix-43/ns2-33-intallation-and-path-setting-818634/#4

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