I downloaded the Network Simulator NS-2 from here -
http://www.isi.edu/nsnam/ns/ns-build.html#allinone
Build ns via GCC 4.2.2 -
tar-xzf ns-allinone-2.35.tar.gz
cd ns-allinone-2.35
./install
Get the error message -
make: *** [tk3d.o] Error 1
tk8.5.10 make failed! Exiting ...
For problem with Tcl / Tk see http://www.scriptics.com
I pass on the link - Scriptics.com - there a a message - "The Script Archive is under reconstruction. Please come back soon."
Then i try -
cd ns-allinone-2.35/ && export CC=gcc-4.2 CXX=g++-4.2 && ./install
Get the following message -
================================
* Build tcl8.5.10
================================
checking whether to use symlinks for manpages... no
checking whether to compress the manpages... no
checking whether to add a package name suffix for the manpages... no
checking for gcc... gcc-4.2
checking for C compiler default output file name...
configure: error: C compiler cannot create executables
See 'config.log' for more details
tcl8.5.10 configuration failed! Exiting...
Tcl is not part of the ns project. Please see www.Screeptics.com
to see if they have a fix for your platform.
How to properly build the NS-2 in Linux Mandriva?
I updated GCC to version GCC-4.7.2, then installed ns-2.34. Previously made some changes in the source code -
in mac/mac-802_Ext.h(or in mac-802_11Ext.h for ns 2.35), line 65 - add
# include "cstddef";
also-in file linkstate/ls.h at line 137 replace -
void eraseAll () {erase (baseMap :: begin (), baseMap :: end ());}
to
void eraseAll () {this-> erase (baseMap :: begin (), baseMap :: end ());}
Now let us take a simple test (ns-simple.tcl) -
#Create a simulator object
set ns [new Simulator]
#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red
#Open 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 the NAM trace file
close $nf
#Execute 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 Queue Size of link (n2-n3) to 10
$ns queue-limit $n2 $n3 10
#Give 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 the queue for link (n2-n3). (for NAM)
$ns duplex-link-op $n2 $n3 queuePos 0.5
#Setup 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
Run (according to http://networksimulator2.files.wordpress.com/2010/10/faqtroubleshootinginstallation_problems.pdf) -
export DISPLAY localhost:6000
ns ns-simple.tcl
Output -
CBR packet size = 1000
CBR interval = 0.0080000000000000002
[root@localhost ...]# _X11TransSocketINETConnect() can't get address for http://localhost:12000: Name or service not known
nam: couldn't connect to display "http://localhost:6000"
What could this mean? How to get the image?
Next. If I point IP of the remote server on which i installed ns-2, I get the following error -
[root@localhost ...]# export DISPLAY=..ip_of_remote_server_:0.0
[root@localhost ...]# ns ns-simple.tcl
CBR packet size = 1000
CBR interval = 0.0080000000000000002
[root@localhost ...]# Xlib: connection to "ip_of_remote_server_:0.0" refused by server
Xlib: No protocol specified
nam: couldn't connect to display "ip_of_remote_server_:0.0"