LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-26-2012, 12:46 AM   #1
Narges
Member
 
Registered: Oct 2011
Posts: 32

Rep: Reputation: Disabled
can't find file to patch at input line n problem, Installing WiMax module on ns2-29


Hi.
I want to install WiMax module on ns2-29-3 in Fedora 15.
I have downloaded the patch file(patch-QoS-WiMAX-13Apr2009-v2.1) in ns-allinone-2.29 directory.
when applying the patch I get the following error:

[narges@localhost ns-allinone-2.29]$ patch -p0<patch-QoS-WiMAX-13Apr2009-v2.1
patching file ns-2.29-new/autoconf.h
can't find file to patch at input line 100
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Naur ns-2.29-original/common/packet.h ns-2.29-new/common/packet.h
|--- ns-2.29-original/common/packet.h 2009-04-13 11:39:11.000000000 +0200
|+++ ns-2.29-new/common/packet.h 2008-04-09 13:12:04.000000000 +0200
--------------------------
File to patch:


I noticed a new folder ns-2.29-new is created under ns-allinone-2.29 directory and there's autoconf.h file in there.

What should I do now?
please help me.
Thank you.
 
Old 07-26-2012, 11:15 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Very simple :

Start from scratch with a new unpacked ns-allinone-2.29.3.tar.gz
Rename (ns-allinone-2.29)/ns-2.29/ to ns-2.29-new

.. And when you have finished the patching, rename ns-2.29-new to ns-2.29

Then you can do :
cd ns-allinone-2.29/ && export CC=gcc34 CXX=g++34 && ./install


ns2 prerequisites : # yum install \
gcc-c++ compat-gcc-34-c++ automake autoconf libtool libX11-devel \
libXext-devel libXau-devel libXmu-devel xorg-x11-proto-devel

.

Last edited by knudfl; 07-26-2012 at 12:19 PM.
 
Old 07-26-2012, 12:26 PM   #3
Narges
Member
 
Registered: Oct 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Dear knudfl,
Thanks for the reply.

So what you are saying is that I have to install ns2 again? and apply the patch before installing it?
Isn't there any way that I dont have to install a new ns2?
What if I want to install another patches later? I mean we cannot install the whole ns2 again just to apply patch, am I right?
Thank you.
 
Old 07-26-2012, 03:35 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
It is of course possible to add the patching after the first build (./install).

cd ns-allinone-2.29/ns-2.29/ && cp ns ns229-backup && make clean
( The new patched version of 'ns' may not be usable for default tcl files.)
&& mv Makefile Makefile-orig && cd ../

Then you can rename : mv ns-2.29/ ns-2.29-new
.. And do the patching : patch -p0 < patch-QoS-WiMAX-13Apr2009-v2.1
And rename to ns-2.29 again : mv ns-2.29-new/ ns-2.29

Now you can do the new "wimax build".

.
 
Old 07-30-2012, 09:14 AM   #5
Narges
Member
 
Registered: Oct 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Hi.
Thanks again for your reply.
I've done what you have said.
The wimax files are in corresponding folders.
Then under ns-2.29 directory I did : ./configure, make clean, make.
Now, when I run ./configure, after lots of checking lines, I get the following error:

configure: creating ./config.status
config.status: creating Makefile
config.status: error: cannot find input file: tcl/lib/ns-autoconf.tcl.in

what should I do now? Can I copy and paste this file from another ns-allinone file?
when I run the wimax examples provided, I get:

invalid command name "Mac/802_16"
while executing
"Mac/802_16 set debug_ 0"
(file "8MN_datarate.tcl" line 45)

I guess thats becoz ns doesnt recognise wimax yet, right?
 
Old 07-30-2012, 10:58 AM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
#5
Quote:
config.status: error: cannot find input file: tcl/lib/ns-autoconf.tcl.in
It's an error in the patch. The patching will delete ns-autoconf.tcl.in,
and 'configure' will still want to use it to generate an ns-autoconf.tcl
That's not what we want: The patch has provided the right ns-autoconf.tcl

The required workaround :
1) cd ns-allinone-2.29/ns-2.29/tcl/lib/
2) mv ns-autoconf.tcl ns-autoconf.tcl-new
3) Copy an original ns-autoconf.tcl.in to tcl/lib/
... from another unpacked ns-allinone-2.29.3.tar.gz
4) cd ../../ && export CC=gcc34 CXX=g++34 && ./configure
5) cd tcl/lib/ && mv ns-autoconf.tcl-new ns-autoconf.tcl
6) cd ../../ && make clean && make : A new 'ns' is created OK.

The 32bits Fedora 15 was used for the above.


By the way : Did you remember to make a backup of the original ns ?

.

Last edited by knudfl; 07-30-2012 at 11:00 AM.
 
Old 07-30-2012, 11:49 AM   #7
Narges
Member
 
Registered: Oct 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Thank you. I did all the steps as you said.
The problem with tcl/lib/ns-autoconf.tcl.in is solved now.
When configured, I get the following :

configure: creating ./config.status
config.status: creating Makefile
config.status: creating tcl/lib/ns-autoconf.tcl
config.status: creating indep-utils/webtrace-conv/ucb/Makefile
config.status: creating indep-utils/webtrace-conv/dec/Makefile
config.status: creating indep-utils/webtrace-conv/nlanr/Makefile
config.status: creating indep-utils/webtrace-conv/epa/Makefile
config.status: creating indep-utils/cmu-scen-gen/setdest/Makefile
config.status: creating autoconf.h
config.status: autoconf.h is unchanged

and make clean and make. It seems theres no problem.
But when I run the examples I get the same error I got before:

invalid command name "Mac/802_16"
while executing
"Mac/802_16 set debug_ 0"
(file "8MN_datarate.tcl" line 45)

I reconfigured, make clean and make again. I cannot understand why ns2 does not recognise WiMax?
I mean all the wimax files are copied in ns2. and i compiled it, several times and theres no error. so whats wrong with it?


Quote:
By the way : Did you remember to make a backup of the original ns ?
yes, I did: cd ns-allinone-2.29/ns-2.29/ && cp ns ns229-backup as you mentioned earlier.

I really appreciate the time you spend to help me.
 
Old 07-30-2012, 02:12 PM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 7
Quote:
But when I run the examples
Please specify. Which examples.tcl is it about ? ?
 
Old 07-30-2012, 10:41 PM   #9
Narges
Member
 
Registered: Oct 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Quote:
Please specify. Which examples.tcl is it about ? ?
The wimax examples in tcl/wimax directory. (for example : QoS_example1.tcl)
 
Old 07-31-2012, 01:19 AM   #10
Narges
Member
 
Registered: Oct 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Could the problem be related to Makefile file in ns-2.29?

Quote:
&& mv Makefile Makefile-orig && cd ../
Should I have renamed that Makefile-orig back to Makefile again? I followd exactly what you wrote.
I have 4 makefiles in ns-2.29 (makefile.vc, Makefile, Makefile.in and Makefile-orig) with different file sizes.


I tried another wimax example, in ns-2.29/tcl/lib (ns-wimax.tcl), and I got an error saying:
invalid command name "Phy/WirelessPhy/OFDM"

So means although I applied the patch and there is a wimax directory in ns-2.29 and ./configured,make clean,make with no error, but the classes there are unknown to ns2.
 
Old 07-31-2012, 02:24 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Don't know, what you are doing.

You should now have two different binaries "ns" :
The unpatched 'ns-orig', and a new 'ns'
( I'm using the name ns-wimax-QoS for new patched 'ns' ).

Copy or link "ns-wimax-QoS" to ns-2.29/tcl/wimax/ ,
or : cp ns /usr/local/bin/.

Running the example, see QoS_example1.tcl line 6 - 11 :
Code:
	puts "Usage: ns datarate.tcl modulation cyclic_prefix "
        puts "modulation: OFDM_BPSK_1_2, OFDM_QPSK_1_2, OFDM_QPSK_3_4"
        puts "            OFDM_16QAM_1_2, OFDM_16QAM_3_4, OFDM_64QAM_2_3, OFDM_64QAM_3_4"
        puts "cyclic_prefix: 0.25, 0.125, 0.0625, 0.03125"
        puts "rtPS scheduler: NIST_RR, RR, mSIR, WRR, TRS_RR, TRS_mSIR"
Which means a command like :
./ns-wimax-QoS 8MN_datarate.tcl QoS_example1.tcl OFDM_QPSK_1_2 0.03125
Or : ./ns-wimax-QoS QoS_example1.tcl 8MN_datarate.tcl OFDM_BPSK_1_2 0.125
... But there are a few errors in the tcl scripts, so we don't get a simulation.

Code:
num_nodes is set 30
sink node created
INITIALIZE THE LIST xListHead

    (_o54 cmd line 1)
    invoked from within
"_o54 cmd set-default-modulation QoS_example1.tcl"
    invoked from within
"catch "$self cmd $args" ret"
    invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
    (procedure "_o54" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$bs_sched set-default-modulation [lindex $argv 0]     "
    (file "8MN_datarate.tcl" line 144)
May be the two scripts should be edited ?

.

Last edited by knudfl; 07-31-2012 at 02:29 AM.
 
Old 09-05-2012, 05:26 AM   #12
Narges
Member
 
Registered: Oct 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
post #11
Quote:
May be the two scripts should be edited ?
Have you worked with wimax before? do you know which part I should modify to get result?
 
Old 12-14-2012, 02:08 AM   #13
Narges
Member
 
Registered: Oct 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Hi again.
I installed ns2 and wimax patch successfully following your advice.
but I have 2 questions here.
you said earlier that :
Quote:
You should now have two different binaries "ns" :
The unpatched 'ns-orig', and a new 'ns'
( I'm using the name ns-wimax-QoS for new patched 'ns' ).
But I have only one "ns" in /ns-2.29 directory. why? why do you have two ns binaries and I have only one? i did exactly as you said for patch:
Quote:
Then you can rename : mv ns-2.29/ ns-2.29-new
.. And do the patching : patch -p0 < patch-QoS-WiMAX-13Apr2009-v2.1
And rename to ns-2.29 again : mv ns-2.29-new/ ns-2.29
If I want to run the tcl examples in /tcl/wimax directory, I just type "ns" not ns-wiamx or anything else and I'm able to run the tcl files.
see example here:

Code:
na@ubuntu:~/ns2/ns-allinone-2.29/ns-2.29/tcl/wimax$ ns QoS_example1.tcl OFDM_BPSK_1_2 0.25 mmSIR
and I get results.

However, when I change inside files in /ns-2.29/wimax, for example, I add or remove a method inside a header or cpp file , and I save changes and I do make clean, make depend,make, I get no errors,but running the wimax tcl example I see the changes are not affected (for instance I'm still able to use the method I removed from the files).
I tried this command after make,
Quote:
cp ns /usr/local/bin/.
. and now the changes I made in the files are working.
But everytime I change inside .h and .cc files, after using make,I have to use the command above, for changes to take effect.
I dont want to repeat it every single time I change sth inside files.
What should I do for that?

Thank you in advance.
 
Old 12-14-2012, 02:53 AM   #14
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
# 13

Quote:
I dont want to repeat it every single time I change sth inside files.
When you are patching / making changes in say five different ways,
the suggestion is to rename any new "ns" to a recognizable name.
And use as e.g. : 1) $ ns229 ( Or $ 'ns-orig' for an unpatched.)
2) $ ns-wimax 3) $ ns-wimax-abc 4) ns-wimax-yyz 5) $ ns-<???>

How else will you keep track of many different functions ?
And : It's the only way to save "ns" : ns gets deleted, when you 'make clean'.
That's the reason for $ 'cp ns ns-new-name' before every 'make clean'.
About 'make install' : Copies ns to /usr/local/bin/.
You can as well copy all different ns-? to /usr/local/bin/.
( I'd usually have 20 different 'ns-<>' : No problems using all.)

.
 
Old 12-15-2012, 04:41 AM   #15
Narges
Member
 
Registered: Oct 2011
Posts: 32

Original Poster
Rep: Reputation: Disabled
Thank you so much for the explanation.

So the first time I install ns-allinone, after make,"ns" created and I change it "cp ns ns-unpatched" and "su cp ns-unpatched /usr/local/bin"
then after installing wimax patch,after make,"ns" created and I change it to "cp ns ns-wimax" and "su cp ns-wimax /usr/local/bin"
and If I modify sth and make,again "cp ns ns-wimax-1" and "su cp ns-wimax-1 /usr/local/bin" and goes on.
did I get it correctly?
So everytime I change I have to do "cp ns-name /usr/local/bin" and overwrite ns-name because without it the lates changes are not applied. (I checked after "make" and no changes afftected. I overwirte ns-name in /usr/local/bin and run the tcl and then it is applied.)

and what if you remove one of your "ns-name" from your /ns-2.29 directory.
what is the command to remove it from /usr/local/bin ?
 
  


Reply

Tags
ns2, patch, wimax, wimax-qos



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to installing LTE module patch in NS2.33 kiwiw Ubuntu 179 02-27-2015 03:27 AM
A problem with installing Wimax model in ns2 maha.ahmed Linux - Newbie 4 08-04-2012 03:39 AM
please help me,, how to patch LTE module in NS2.33... hadi wibowo General 0 05-14-2012 11:16 AM
patch LTE module for ns2 Emna Linux - Newbie 1 03-10-2011 02:59 AM
problem in installing working NS2 and ATM patch kshitiz Linux - Software 2 03-02-2011 11:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:28 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration