LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   recompiling .h and .cc files in ns2 does not shows changes made to them (https://www.linuxquestions.org/questions/linux-newbie-8/recompiling-h-and-cc-files-in-ns2-does-not-shows-changes-made-to-them-4175440021/)

Narges 12-04-2012 12:23 PM

recompiling .h and .cc files in ns2 does not shows changes made to them
 
Hi. I'm working in ns-2.29 on fedora 15.
I've made some changes inside already existing header and c++ files in wimax directory in ns2.
I saved the changes, then under /ns-2.29 I applied following:

make clean
make depend
make

to recompile ns2 and I got no errors, I got:
make[1]: Entering directory `/home/N/ns2/ns-allinone-2.29/ns-2.29/indep-utils/cmu-scen-gen/setdest'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/N/ns2/ns-allinone-2.29/ns-2.29/indep-utils/cmu-scen-gen/setdest'
...

which I know its not an error.
but even after recompiling the files,the changed I made are not applied.
when I run my tcl file I get an error.
what should I do to properly compile the codes so it reflects my modifications?
Thanks in advance.

John VV 12-04-2012 01:44 PM

make DOSE NOT install anything

Code:

su
make install

will install to the $PREFIX directory ( if used in the makefile)

most programs install to /usr or /usr/local by default


Now some require that YOU manually move the program out of the build folder
or
run in the build folder ( not a good idea )

also
did you restart the very OLD ns 2.29 ( .34 is the current OLD 2 version i think. )

also be advised that fedora 15 is UNSUPPORTED

currently ONLY fedora 16 and 17 are supported and VERY SOON fedora 16 will go END OF LIFE after fedora 18 comes out


DOSE the "makefile" actually have a "clean" section DEFINED ????
not all do ?
if not YOU will have to manually delete the old files YOU defined in the BUILD folder and rebuild
( it is EVER NEVER NEVER YES NEVER a good idea to build software IN your source folder/ working folder )

also "make clean" will NOT remove any prerequisites that needed building
" distclean" will do that IF defined in the makefile

knudfl 12-04-2012 02:10 PM

Yes, everything looks OK.

Quote:

I've made some changes inside already existing header and c++ files in wimax
I guess you will have to show the changes. In code tags, please.
And please tell which files it's about, + specify the edited line numbers.

Also : Please attach your tcl script. As name.tcl.txt .
Attachments : The paper clip tool in the 'Advanced Editor'.


.

Narges 12-04-2012 11:44 PM

Thank you for the reply.

Quote:

make DOSE NOT install anything
Code:
su
make install
But I didnt want to install anything, I just want to recompile the code.

Quote:

did you restart the very OLD ns 2.29 ( .34 is the current OLD 2 version i think. )
Yes I did restart.

Quote:

DOSE the "makefile" actually have a "clean" section DEFINED ????
I dont understand what "clean" section deos, but inside my Makefile.in I can see:

CLEANFILES = ns nse nsx ns.dyn $(OBJ) $(OBJ_EMULATE_CC) \
$(OBJ_EMULATE_C) common/tclAppInit.o \
$(GEN_DIR)* $(NS).core core core.$(NS) core.$(NSX) core.$(NSE) \
common/ptypes2tcl common/ptypes2tcl.o
and
clean:
$(RM) $(CLEANFILES)
and
distclean: distclean-recursive
$(RM) $(CLEANFILES) Makefile config.cache config.log config.status \
autoconf.h gnuc.h os-proto.h $(AUTOCONF_GEN); \
$(MV) .configure .configure- ;\
echo "Moved .configure to .configure-"

distclean-recursive:
for i in $(SUBDIRS); do ( cd $$i; $(MAKE) clean; $(RM) Makefile; ) done

Narges 12-04-2012 11:46 PM

Thank you for the reply.
Quote:

And please tell which files it's about, + specify the edited line numbers.
I'm working in Wimax QoS module I downloaded from this Site : http://perso.telecom-bretagne.eu/aymenbelghith/tools/‎
I added new algorithm inside /wimax/scheduling/bsscheduler.h and .cc files. There are some algorithms alreay defined there.
in bsscheduler.h,I decleared my algorithm and in bsscheduler.cc I defined its body, also in command() function I added the algorithm name like other algorithms so when user runs the tcl file and enteres the algorithm name ns runs the algorithm code.

SO,
when I compile using: make clean , make depend , make , I get no errors.
When I run the tcl and choose "M" as algorithm,I get following:
Error! Unknown rtPS scheduling algorithm

This line is written inside commande() function in bsscheduler.cc
I've added my algorithm name inside command() but I dont know why it doesnt recognise it.

VankaSaiSumanth 02-28-2019 07:10 AM

Error solved. Thank you for the post
 
Quote:

Originally Posted by Narges (Post 4842690)
Hi. I'm working in ns-2.29 on fedora 15.
I've made some changes inside already existing header and c++ files in wimax directory in ns2.
I saved the changes, then under /ns-2.29 I applied following:

make clean
make depend
make

to recompile ns2 and I got no errors, I got:
make[1]: Entering directory `/home/N/ns2/ns-allinone-2.29/ns-2.29/indep-utils/cmu-scen-gen/setdest'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/N/ns2/ns-allinone-2.29/ns-2.29/indep-utils/cmu-scen-gen/setdest'
...

which I know its not an error.
but even after recompiling the files,the changed I made are not applied.
when I run my tcl file I get an error.
what should I do to properly compile the codes so it reflects my modifications?
Thanks in advance.

After running "make", the re-compilation is done but to apply the changes one need to install it again. You may be currently in ns-2.35 directory when running the make.
Now run "sudo make install".

Quote:

sumanth@sumanth-HP-Notebook:~/Documents/ns-allinone-2.35/ns-2.35$ sudo make install
if you just run "make install", it may give an error like this
Quote:

for d in /usr/local/man/man1; do \
if [ ! -d $d ]; then \
mkdir -p $d ;\
fi;\
done
/usr/bin/install -c -m 755 ns /usr/local/bin
/usr/bin/install: cannot create regular file '/usr/local/bin/ns': Permission denied
Makefile:557: recipe for target 'install-ns' failed
make: *** [install-ns] Error 1
Then run tcl scripts to see the desired output and applied changes.

sowjanyadasari 04-06-2023 02:09 AM

I got an error when I tried to execute the "sudo make install" command after making changes in the .cc file. Can I get some help to resolve
 
Now run "sudo make install".

if you just run "make install", it may give an error like this

I have run the "sudo make install" command and I got an error similar to what you've said.

It's like this:
for d in /usr/local/man/man1; do \
if [ ! -d $d ]; then \
mkdir -p $d ;\
fi;\
done
/usr/bin/install -c -m 755 ns /usr/local/bin
/usr/bin/install -c -m 644 ns.1 usr/local/man/man1

How to resolve this error? Could someone help me with this?

knudfl 04-06-2023 02:52 AM

Post #7, @sowjanyadasari : Welcome to LQ.

No errors are shown in the quoted text. (And no word "error").
... The text only shows what's happening !

$ man install https://linux.die.net/man/1/install

ns2 INFO https://docs.google.com/document/d/1...usp=share_link

-

sowjanyadasari 04-07-2023 01:27 PM

Ohh Okay! Thanks for the reply. I didn't realise it, but the changes I've made aren't being reflected when I run the TCL file. Can anyone explain why?

And if there's any tutorial/ video/ web page on how to modify protocols in ns2, sharing the link for the same would be appreciated. Thank you :)

knudfl 04-11-2023 03:10 AM

Re #9
Quote:

changes I've made aren't being reflected when I run the TCL file
Generally about changes in C++ code ......
1) Sometimes the right "Tcl hook" must be included in the C++ code.
2) And changes may have to include some lines in tcl/lib/[ns-files.tcl]
... e.g. ns-agent.tcl, ns-default.tcl?, ns-lib.tcl, ns-mobilenode.tcl, ns-packet.tcl
3) A certain text may be required in the simulation.tcl to achieve a visible result in the terminal output / in some extra output file(s).

-

sowjanyadasari 04-18-2023 03:54 AM

Quote:

Originally Posted by knudfl (Post 6423746)
Re #9


Generally about changes in C++ code ......
1) Sometimes the right "Tcl hook" must be included in the C++ code.
2) And changes may have to include some lines in tcl/lib/[ns-files.tcl]
... e.g. ns-agent.tcl, ns-default.tcl?, ns-lib.tcl, ns-mobilenode.tcl, ns-packet.tcl
3) A certain text may be required in the simulation.tcl to achieve a visible result in the terminal output / in some extra output file(s).

-

Thank you! I am able to make changes and the changes are being reflected when I run the tcl script.


All times are GMT -5. The time now is 12:47 AM.