Wednesday, June 9, 2010

NS2.31 NAM problem - "[code omitted because of length]"

Problem: While executing NAM in NS2 following error 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..."

Solution: 

  1. Download  "tk-8.4-lastevent.patch" patch file from http://bugs.gentoo.org/show_bug.cgi?id=225999
  2. Save the file in tk8.4.x floder (remember that there could be tk8.4.14 or tk8.4.18)
  3. Patch the file with this command

                         patch -p1 < ./tk-8.4-lastevent.patch

    4.  install again (with ./install command)

Now it works perfectly. 

(If there is a problem on patching, change -p1 to -p0. )

12 comments:

apctr said...

thanks a lot.....it works.....

Chang Liu said...

It works! Thanks a lot.

Anonymous said...

yeah... it works! thanks a lot for sharing.

Irene said...

you are the master, it really works, thanks

Veenit Shah said...

I did not know how to actually apply a patch.
The above steps worked with -p0 for me. Thank you.

Unknown said...

hi
i wrote a new agent and modified the relevant files (makefile,packet.h,ns-default.tcl ) ,then i make clean and make the ns-2.34 i get this error (no rule to make target 'vanet.o' needed by ns) and when i want to run my tcl file i get this error (ns: [code ommited because of length] : invalid command name "Agent/Vanet" while executing "Agent/Vanet set packetSize_ 64").

will u pls help me out with this error.
i appreciate any help.
ps: tcl/tk 8.4.18 have already been installed.

Unknown said...

I have fedora 10 with ns-2.32 and have the same problem. I have tcl and tk8.4.15 and it does not work properly. I also followed step of Badar Abbas from fedora forum but that too did not worked. Any idea for ns-2.32.

GP Joshi said...

Sorry, I didn't work with ns-2.32. But, if you see the pach code carefully, you may solve the problem. Good luck.

Rohini said...

sir I tried this path on ns2.29 on ubuntu 10.04 but it says
ns-allinone-2.29/tk8.4.11$ patch -p1 < ./tk-8.4-lastevent.patch
(Stripping trailing CRs from patch.)
patching file tk.h
patch unexpectedly ends in middle of line
Hunk #1 FAILED at 635.
1 out of 1 hunk FAILED -- saving rejects to file tk.h.rej
what is the solution

GP Joshi said...

Hi Rohini,
You are applying wrong patch. A hunk fails if it doesn't match with the original file. Different version of NS-2 has different code. So, you have to select appropriate patch, or you have to change the code. Check the line number and piece of code in the patch.

ddd123 said...
This comment has been removed by the author.
ddd123 said...

Hi everyone,
I have the same issue, When I tried install the patch in Opensuse 12.2:

/usr/src/ns-allinone-2.31/tk8.4.14 # patch -p0 < ./tk-8.4-lastevent.patch
the following message appears: If 'patch' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf patch
Any suggest? The folder is correct?
Excuse my poor English,regards Diego.