LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   can't find file to patch at input line n problem, Installing WiMax module on ns2-29 (https://www.linuxquestions.org/questions/linux-newbie-8/can%27t-find-file-to-patch-at-input-line-n-problem-installing-wimax-module-on-ns2-29-a-4175418708/)

Narges 07-26-2012 12:46 AM

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.

knudfl 07-26-2012 11:15 AM

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

.

Narges 07-26-2012 12:26 PM

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.

knudfl 07-26-2012 03:35 PM

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".

.

Narges 07-30-2012 09:14 AM

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?

knudfl 07-30-2012 10:58 AM

#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 ?

.

Narges 07-30-2012 11:49 AM

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.

knudfl 07-30-2012 02:12 PM

# 7
Quote:

But when I run the examples
Please specify. Which examples.tcl is it about ? ?

Narges 07-30-2012 10:41 PM

Quote:

Please specify. Which examples.tcl is it about ? ?
The wimax examples in tcl/wimax directory. (for example : QoS_example1.tcl)

Narges 07-31-2012 01:19 AM

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.

knudfl 07-31-2012 02:24 AM

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 ?

.

Narges 09-05-2012 05:26 AM

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?

Narges 12-14-2012 02:08 AM

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.

knudfl 12-14-2012 02:53 AM

# 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.)

.

Narges 12-15-2012 04:41 AM

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 ?


All times are GMT -5. The time now is 09:37 AM.