Dear can any one help me please:::
when I am writing nam in terminal window : segmentation fault is appear, can any one tell me why?? note It is a new ns installing, my platform (Ubuntu 14.04LTS 64bit, ns-2.35 , ns simulation normaly ... in addition when I am run a simple tcl program, for example following tcl program ns-simple.tcl: ?#?Create? <https://www.facebook.com/hashtag/create?source=feed_text&story_id=10152410339444659> a simulator object set ns [new Simulator] ?#?Define? <https://www.facebook.com/hashtag/define?source=feed_text&story_id=10152410339444659> different colors for data flows (for NAM) $ns color 1 Blue $ns color 2 Red ?#?Open? <https://www.facebook.com/hashtag/open?source=feed_text&story_id=10152410339444659> the NAM trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} { global ns nf $ns flush-trace ?#?Close? <https://www.facebook.com/hashtag/close?source=feed_text&story_id=10152410339444659> the NAM trace file close $nf ?#?Execute? <https://www.facebook.com/hashtag/execute?source=feed_text&story_id=10152410339444659> NAM on the trace file exec nam out.nam & exit 0 } #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] #Create links between the nodes $ns duplex-link $n0 $n2 2Mb 10ms DropTail $ns duplex-link $n1 $n2 2Mb 10ms DropTail $ns duplex-link $n2 $n3 1.7Mb 20ms DropTail ?#?Set? <https://www.facebook.com/hashtag/set?source=feed_text&story_id=10152410339444659> Queue Size of link (n2-n3) to 10 $ns queue-limit $n2 $n3 10 ?#?Give? <https://www.facebook.com/hashtag/give?source=feed_text&story_id=10152410339444659> node position (for NAM) $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns duplex-link-op $n2 $n3 orient right ?#?Monitor? <https://www.facebook.com/hashtag/monitor?source=feed_text&story_id=10152410339444659> the queue for link (n2-n3). (for NAM) $ns duplex-link-op $n2 $n3 queuePos 0.5 ?#?Setup? <https://www.facebook.com/hashtag/setup?source=feed_text&story_id=10152410339444659> a TCP connection set tcp [new Agent/TCP] $tcp set class_ 2 $ns attach-agent $n0 $tcp set sink [new Agent/TCPSink] $ns attach-agent $n3 $sink $ns connect $tcp $sink $tcp set fid_ 1 #Setup a FTP over TCP connection set ftp [new Application/FTP] $ftp attach-agent $tcp $ftp set type_ FTP #Setup a UDP connection set udp [new Agent/UDP] $ns attach-agent $n1 $udp set null [new Agent/Null] $ns attach-agent $n3 $null $ns connect $udp $null $udp set fid_ 2 #Setup a CBR over UDP connection set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $cbr set type_ CBR $cbr set packet_size_ 1000 $cbr set rate_ 1mb $cbr set random_ false ?#?Schedule? <https://www.facebook.com/hashtag/schedule?source=feed_text&story_id=10152410339444659> events for the CBR and FTP agents $ns at 0.1 "$cbr start" $ns at 1.0 "$ftp start" $ns at 4.0 "$ftp stop" $ns at 4.5 "$cbr stop" ?#?Detach? <https://www.facebook.com/hashtag/detach?source=feed_text&story_id=10152410339444659> tcp and sink agents (not really necessary) $ns at 4.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink" ?#?Call? <https://www.facebook.com/hashtag/call?source=feed_text&story_id=10152410339444659> the finish procedure after 5 seconds of simulation time $ns at 5.0 "finish" ?#?Print? <https://www.facebook.com/hashtag/print?source=feed_text&story_id=10152410339444659> CBR packet size and interval puts "CBR packet size = [$cbr set packet_size_]" puts "CBR interval = [$cbr set interval_]" ?#?Run? <https://www.facebook.com/hashtag/run?source=feed_text&story_id=10152410339444659> the simulation $ns run the out put messages in terminal as following: CBR packet size = 1000 CBR interval = 0.0080000000000000002 ----------------- but wihout nam window??? After my search in ns-users (FAQ) I found this post in addition one of users in 2001 have same problem but without respons Problem: namtrace-all causes segmentation fault on Linux and Solaris 2.6. It's caused by sprintf's inability to handle null pointers in those systems. Solution: Apply the following patch to ~ns-2/trace.cc: --- trace.cc~ 1998/07/17 22:37:25 +++ trace.cc 1998/07/20 18:07:53 @@ -185,7 +185,7 @@ hdr_rtp *rh = (hdr_rtp*)p->access(off_rtp_); hdr_srm *sh = (hdr_srm*)p->access(off_srm_); - const char* sname = 0; + const char* sname = "null"; int t = th->ptype(); const char* name = pt_names[t]; @@ -413,7 +413,7 @@ hdr_cmn *th = (hdr_cmn*)p->access(off_cmn_); hdr_ip *iph = (hdr_ip*)p->access(off_ip_); hdr_srm *sh = (hdr_srm*)p->access(off_srm_); - const char* sname = 0; + const char* sname = "null"; int t = th->ptype(); const char* name = pt_names[t];