Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
02-25-2014, 05:25 PM
|
#16
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
# 13 .
Ubuntu 10.04 : $ sudo apt-get install g++-4.1
* The Ubuntu 10.04 build command for all ns-2.26 ... ns-2.34 :
$ export CC=gcc-4.1 CXX=g++-4.1 && ./install
* If you are reconfiguring in ns-allinone-2.xx/2.xx/ :
$ make distclean && export CC=gcc-4.1 CXX=g++-4.1 && ./configure && make
-
Last edited by knudfl; 02-25-2014 at 05:27 PM.
|
|
|
02-26-2014, 01:18 AM
|
#17
|
Member
Registered: Apr 2013
Posts: 197
Original Poster
Rep:
|
Quote:
Originally Posted by knudfl
# 13 .
* If you are reconfiguring in ns-allinone-2.xx/2.xx/ :
$ make distclean && export CC=gcc-4.1 CXX=g++-4.1 && ./configure && make
-
|
this command should run in ns-2.34/
?
I have make clean and export CC=gcc-4.1 CXX=g++-4.1 && ./configure && make in ns-2.34
installed successfully
but again
same error
Code:
ns: record: can't read "firstPktTime_": no such variable
while executing
"subst $[subst $var]"
(procedure "_o99" line 5)
(Object next line 5)
invoked from within
"_o99 next firstPktTime_"
("eval" body line 1)
invoked from within
"eval $self next $args"
(procedure "_o99" line 18)
(Agent set line 18)
invoked from within
"$null_($i) set firstPktTime_"
I tried some other variables also but none is adding to loss-monitor.cc
all saying same error
Last edited by Aska123; 02-26-2014 at 01:31 AM.
|
|
|
02-26-2014, 04:58 AM
|
#18
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
# 17 .
OK, better use ./install instead of reconfiguring.
The "make distclean" is then done automatically in tcl8.4*, tk8.4*, ns-2.34/,
.. so to be absolutely sure of a clean ns2, do the 'make distclean' manually
.. in otcl-1.13/ and tclcl-1.19/ .
Then it's : $ export CC=gcc-4.1 CXX=g++-4.1 && ./install
-
|
|
|
02-26-2014, 05:20 AM
|
#19
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
# 17 .
P.S. : No errors here with `Ubuntu 10.04' :
(1) $ export CC=gcc-4.1 CXX=g++-4.1 && ./install
(2) $ cd ns-2.34/ && ./ns test.tcl
-
|
|
|
02-26-2014, 06:08 AM
|
#20
|
Member
Registered: Apr 2013
Posts: 197
Original Poster
Rep:
|
Quote:
Originally Posted by knudfl
# 17 .
OK, better use ./install instead of reconfiguring.
The "make distclean" is then done automatically in tcl8.4*, tk8.4*, ns-2.34/,
.. so to be absolutely sure of a clean ns2, do the 'make distclean' manually
.. in otcl-1.13/ and tclcl-1.19/ .
-
|
how to do it make distclean manually
should I delete ns-allinone-2.34 folder and re-install it?
Last edited by Aska123; 02-26-2014 at 06:14 AM.
|
|
|
02-26-2014, 06:48 AM
|
#21
|
Member
Registered: Apr 2013
Posts: 197
Original Poster
Rep:
|
dear Knudfi I try the same file on ns-2.29
after making chages to loss-monitor.h and .cc file and ns-default.tcl file
ALso I changed name of firstPktTime_ to first_packet_time_
Code:
ns: record: can't read "first_packet_time_": no such variable
while executing
"subst $[subst $var]"
(procedure "_o99" line 5)
(Object next line 5)
invoked from within
"_o99 next first_packet_time_"
("eval" body line 1)
invoked from within
"eval $self next $args"
(procedure "_o99" line 18)
(Agent set line 18)
invoked from within
"$null_($i) set first_packet_time_"
(procedure "record" line 8)
invoked from within
"record"
rohini@ubuntu:~/ns-allinone-2.29$
It seems that no new variable is being added in loss monitor file.
or it may be that we have to add first_packet_time_ some where also
|
|
|
02-26-2014, 06:58 AM
|
#22
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
# 20 .
Quote:
how to do it make distclean manually
|
Well, it's like 'make clean' :
1) $ cd otcl-1.13/
2) $ make distclean
3) $ cd ../tclcl-1.19/
4) $ make distclean
-
|
|
|
02-26-2014, 07:23 AM
|
#23
|
Member
Registered: Apr 2013
Posts: 197
Original Poster
Rep:
|
Dear kundfi
I did it same way as you explained in post #22
But again same error
now I am trying to install ns2.28 . I want to run this script in ns-2.28
may be it works here.
Please tell me steps of installing ns-2.28 in ubuntu 10.04
I trued it like
cd ns-allinone-2.28/ && export CC=gcc-4.1 CXX=g++-4.1 && ./install
error
Code:
tcl8.3.2 configuration failed! Exiting ...
Tcl is not part of the ns project.
if this script works in ns-2.28
then I will remove ns-2.34
|
|
|
02-26-2014, 08:12 AM
|
#24
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
# 23 .
Quote:
then I will remove ns-2.34
|
No. Don't do that. You can have as many ns-allinone-2.xx as you want,
installed at the same time. But : Do never add any *PATH text to .bashrc.
The trick is : Use a copy of the executable 'ns' to e.g. 'ns228-througput',
and copy 'ns228-througput' to /usr/local/bin/ .
Then the executable is a system PATH, and you can do $ ns228-througput test.tcl
( I have 70 different named 'ns's in /usr/local/bin/, they all work perfectly.)
Building ns-2.28 :
1) tar xvf ns-allinone-2.28.tar.gz
2) patch -p0 < ns228-gcc40.patch
3) patch -p0 < ns-2.28-gcc410.patch <Enter> <Enter> <Enter>
4) cd ns-allinone-2.28/
5) export CC=gcc-4.1 CXX=g++-4.1 && ./install
6) cd ns-2.28/
7) cp ns ns228-througput
8) sudo cp ns228-througput /usr/local/bin/
... That's it, and you can immediately do $ ns228-througput test.tcl
Patches : Post #15 here http://www.linuxquestions.org/questi...4-a-842773/#15
-
|
|
1 members found this post helpful.
|
02-26-2014, 08:18 AM
|
#25
|
Member
Registered: Apr 2013
Posts: 197
Original Poster
Rep:
|
hello
Knudfi
when I install ns-2.34 by using export CC=gcc-4.1 CXX=g++-4.1 && ./install
I got error of tcl is not part of this project , in both case ns-2.34 and ns-2,28
but when I use sudo su CC=gcc-4.1 CXX=g++-4.1 && ./install
It installed properly.
is this creating problem?
I used one of your previous post to install ns-2.28
It is being installed now.
when i t will get installed.
I will inform you
Last edited by Aska123; 02-26-2014 at 08:20 AM.
|
|
|
02-26-2014, 08:30 AM
|
#26
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
# 25 .
Quote:
but when I use sudo su CC=gcc-4.1 CXX=g++-4.1 && ./install
It installed properly.
is this creating problem ?
|
* That's either a corrupt OS,
or you might have used a "sudo command" previously,
e.g. $ sudo tar xvf ns-allinone-2.xx.tar.gz,
which you are not supposed to do.
All ns2 commands : No sudo.
Except when you install or copy the executable to /usr/local/bin/.
-
|
|
|
02-26-2014, 08:34 AM
|
#27
|
Member
Registered: Apr 2013
Posts: 197
Original Poster
Rep:
|
Quote:
Originally Posted by knudfl
# 25 .
or you might have used a "sudo command" previously,
e.g. $ sudo tar xvf ns-allinone-2.xx.tar.gz,
which you are not supposed to do.
-
|
No I have not used sudo command previously.
I just used it to install
I while installing ns-2.28
error
Code:
make: *** [libotcl.so] Error 1
otcl-1.9 make failed! Exiting ...
|
|
|
02-26-2014, 08:50 AM
|
#28
|
Member
Registered: Apr 2013
Posts: 197
Original Poster
Rep:
|
Installed ns-2.28 successfully without using sudo su
now trying to run test file
|
|
|
02-26-2014, 09:03 AM
|
#29
|
Member
Registered: Apr 2013
Posts: 197
Original Poster
Rep:
|
I followed all these steps
1) tar xvf ns-allinone-2.28.tar.gz
2) patch -p0 < ns228-gcc40.patch
3) patch -p0 < ns-2.28-gcc410.patch <Enter> <Enter> <Enter>
4) cd ns-allinone-2.28/
5) export CC=gcc-4.1 CXX=g++-4.1 && ./install
6) cd ns-2.28/
7) cp ns ns228-througput
8) sudo cp ns228-througput /usr/local/bin/
$ ns228-througput test.tcl
made changes to loss-monitor.h , .cc and ns-default.tcl file
then in ns-2.28/ make clean and make
then $ ns228-througput test.tcl
Code:
rohini@ubuntu:~/test$ ns228-througput lossmonitor.tcl
num_nodes is set 5
INITIALIZE THE LIST xListHead
wireless node 0 created ...
X_:150.00135830880001 Y_:150.55588069999999
wireless node 1 created ...
X_:150.05681863999999 Y_:150.08812266999999
wireless node 2 created ...
X_:151.76469359999999 Y_:150.79915550000001
wireless node 3 created ...
X_:151.25184719999999 Y_:150.81647609999999
wireless node 4 created ...
X_:150.9384072 Y_:150.6388651
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
ns: record: can't read "firstPktTime_": no such variable
while executing
"subst $[subst $var]"
(procedure "_o99" line 5)
(Object next line 5)
invoked from within
"_o99 next firstPktTime_"
("eval" body line 1)
invoked from within
"eval $self next $args"
(procedure "_o99" line 18)
(Agent set line 18)
invoked from within
"$null_($i) set firstPktTime_"
(procedure "record" line 8)
invoked from within
"record"
my test file is as follows
Code:
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagationmodel
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 1000 ;# max packet in ifq
set val(nn) 5 ;# number of mobilenodes
set val(rp) DSDV ;# routing protocol
Mac/802_11 set RTSThreshold_ 3000 ;# bytes
Mac/802_11 set ShortRetryLimit_ 7 ;# retransmittions
Mac/802_11 set LongRetryLimit_ 4 ;# retransmissions
Mac/802_11 set PreambleLength_ 144 ;# 144 bit
Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits
Mac/802_11 set PLCPDataRate_ 1Mb ;# 1Mbps
Mac/802_11 set dataRate_ 1Mb
Mac/802_11 set basicRate_ 1Mb
Mac/802_11 set CWMin_ 31
Mac/802_11 set CWMax_ 1023
Mac/802_11 set SlotTime_ 0.000020 ;# 20us
Mac/802_11 set SIFS_ 0.000010 ;# 10us
set ns_ [new Simulator]
set tracefd [open simple.tr w]
$ns_ trace-all $tracefd
set nf [open out.nam w]
$ns_ namtrace-all-wireless $nf 300 300
set topo [new Topography]
$topo load_flatgrid 300 300
create-god $val(nn)
set chan_1_ [new $val(chan)]
$ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channel $chan_1_ \
-topoInstance $topo \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF \
-movementTrace OFF
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}
set rng [new RNG]
$rng seed 1
set rand1 [new RandomVariable/Uniform]
for {set i 0} {$i < $val(nn) } {incr i} {
puts "wireless node $i created ..."
set x [expr 150+[$rand1 value]*4]
set y [expr 150+[$rand1 value]*1]
$node_($i) set X_ $x
$node_($i) set Y_ $y
$node_($i) set Z_ 0.0
puts "X_:$x Y_:$y"
}
for {set i 0} {$i < $val(nn) } {incr i} {
set udp_($i) [new Agent/UDP]
$ns_ attach-agent $node_($i) $udp_($i)
set null_($i) [new Agent/LossMonitor]
$ns_ attach-agent $node_($i) $null_($i)
}
for {set i 0} {$i < $val(nn) } {incr i} {
if {$i == ($val(nn)-1)} {
$ns_ connect $udp_($i) $null_(0)
} else {
set j [expr $i+1]
$ns_ connect $udp_($i) $null_($j)
}
set cbr_($i) [new Application/Traffic/CBR]
$cbr_($i) attach-agent $udp_($i)
$cbr_($i) set type_ CBR
$cbr_($i) set packet_size_ 1000
$cbr_($i) set rate_ 500kb
$cbr_($i) set random_ false
}
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 1.0 "$cbr_($i) start"
$ns_ at 50.0 "$cbr_($i) stop"
}
# Tell nodes when the simulation ends
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 100.0 "$node_($i) reset";
}
$ns_ at 100.0 "stop"
$ns_ at 100.01 "puts \"NS EXITING...\" ; $ns_ halt"
$ns_ at 45.0 "record"
proc record {} {
global ns_ null_ val first_time last_time
set sum 0
for {set i 0} {$i < $val(nn) } {incr i} {
set th 0
set a [$null_($i) set bytes_]
set b [$null_($i) set lastPktTime_]
set c [$null_($i) set first_packet_time_]
set d [$null_($i) set npkts_]
if {$b>$c} {
set th [expr ($a-$d*20)*8/($b-$c)]
puts "flow $i has $th bps"
}
set sum [expr $sum+$th]
}
puts "total throughput:$sum bps"
}
proc stop {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
}
puts "Starting Simulation..."
$ns_ run
is there any problem with my OS
it is installed on vmware.
changes made are
Code:
1. Modify the tools/loss-monitor.h
class LossMonitor : public Agent {
public:
LossMonitor();
virtual int command(int argc, const char*const* argv);
virtual void recv(Packet* pkt, Handler*);
protected:
int nlost_;
int npkts_;
int expected_;
int bytes_;
int seqno_;
double last_packet_time_;
//add the following two lines
double first_packet_time_;
int first;
};
2. Modify the tools/loss-monitor.cc
LossMonitor::LossMonitor() : Agent(PT_NTYPE)
{
bytes_ = 0;
nlost_ = 0;
npkts_ = 0;
expected_ = -1;
last_packet_time_ = 0.;
first_packet_time_ = 0.;
first=0;
seqno_ = 0;
bind("nlost_", &nlost_);
bind("npkts_", &npkts_);
bind("bytes_", &bytes_);
bind("lastPktTime_", &last_packet_time_);
bind("firstPktTime_", &first_packet_time_);
bind("expected_", &expected_);
}
void LossMonitor::recv(Packet* pkt, Handler*)
{
hdr_rtp* p = hdr_rtp::access(pkt);
seqno_ = p->seqno();
bytes_ += hdr_cmn::access(pkt)->size();
++npkts_;
if(first==0){
first_packet_time_=Scheduler::instance().clock();
first=1;
}
/*
* Check for lost packets
*/
if (expected_ >= 0) {
int loss = seqno_ - expected_;
if (loss > 0) {
nlost_ += loss;
Tcl::instance().evalf("%s log-loss", name());
}
}
last_packet_time_ = Scheduler::instance().clock();
expected_ = seqno_ + 1;
Packet::free(pkt);
}
3. Modify ns-default.tcl file
add
Agent/LossMonitor set firstPktTime_ 0
Last edited by Aska123; 02-26-2014 at 09:07 AM.
|
|
|
02-26-2014, 10:26 AM
|
#30
|
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,519
|
# 29 .
Quote:
my test file is as follows
|
Did you change "test.tcl" ? The original one in post #1 works OK.
# 28 : ""Installed ns-2.28 successfully without using sudo su""
* Any use of 'sudo su' will use a PATH different from using
unprivileged commands : No 'sudo' or 'sudo su' can be used :
If you did, please start from scratch, with a new unpacked
ns-allinone-2.28.tar.gz, in a new directory.
# 29 : ""changes made are""
* You are not supposed to make any changes.
The usable code is included in `throughput-without-parsing-the-trace-file-ns228.tar.bz2'
https://drive.google.com/file/d/0B7S...it?usp=sharing
(And if ns-2.34, in `throughput-without-parsing-the-trace-file-ns234.tar.bz2').
-
|
|
|
All times are GMT -5. The time now is 05:17 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|