Executing .sh script to run ZRP simulations on patched NS-2.35
Linux - Wireless NetworkingThis forum is for the discussion of wireless networking in Linux.
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.
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.
Executing .sh script to run ZRP simulations on patched NS-2.35
Running ns-2.35 on ubuntu 16.04 doing an analysis of different routing protocols. No problems with AODV & DSDV as i know they are in the base version. Have got an automation script that runs and takes in my simulation results and creates neat folders and .csv files.
You can of course not use a tcl-otcl interpreter like 'ns' to run a shell script.
It is `$ ./automate.sh´ ... or if it's a bash script also `$ bash automate.sh´
Quote:
invalid command name "Agent/ZRP"
.
"Agent/ZRIP set radius_2 "
See the EDIT below ...
Ubuntu 16.04: No issues with ns-2.35 + ZRP, unless you changed the default compiler:
The ns-2.35 2014 update (ns-allinone-2.35_gcc482.tar.gz or ns-allinone-2.35_gcc5.tar.gz) requires g++ version <= gcc-5.4 ( ver. 4.4 .. 5.4 No PIE.)
Followed these instructions and got the following results:
Using files given:
./install (no export) results:
Running simulation ($ ns235-zrp zrp-Demo1-1.tcl) Works fine, no errors and creates output
Trying to run .sh script (did not use the ns235-zrp command, just $ ./automate.sh) the same error as before
Code:
invalid command name "Agent/ZRP"
while executing
"Agent/ZRP set radius_ 2 "
Trying to run own .tcl script modified for ZRP using the command
Code:
$ ns235-zrp aodv.tcl
num_nodes is set 10
INITIALIZE THE LIST xListHead
couldn't read file "": no such file or directory
while executing
"source.orig {}"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source $mobility"
(file "aodv.tcl" line 50)
./install with export
Results:
Code:
configure: WARNING: unrecognized options: --enable-gcc
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.8
checking whether the C compiler works... no
configure: error: in `/home/sher/Downloads/ns-allinone-2.35/tcl8.5.10/unix':
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.Scriptics.com
to see if they have a fix for your platform.
Quote:
EDIT : You have some typo´s → "Agent/ZRIP set radius_2 " ... must be:
I should have attached both. I have renamed what was called aodv.tcl to zrp-setup.tcl to make it appropriate for the actual protocol I am using within it, please let me know if you think more detail should be in the file name.
I hope its okay for me to make another reply on here. Just been testing with my actual AODV script that worked, thought i would try open one of my simulations in nam (Which i've used successfully with it plenty before) and now im getting the following error that could be related to whats going on with the above?
Quote:
$nam
Can't find a usable init.tcl in the following directories:
:/opt/ns-allinone-2.35/tcl8.5.10/library/
This probably means that Tcl wasn't installed properly.
Aborted (Core dumped)
Like i say this definitely worked before i started trying to implement the ZRP patch.
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513
Rep:
Re #5.
"automate.sh" : Line 43, the command is not ns but ns235-zrp.
My line 43: ns235-zrp zrp-setup.tcl mobility_files/mob$i
(The command 'ns235-zrp' can usually also be used for simulations with other protocols.)
"zrp-setup.tcl", line 50 : Must be `# source $mobility´, i.e. commented out.
→ You already have the real settings of $mobility in automate.sh
I have spent the last few days starting again with my VM & Ubuntu, creating backups along each step of the way to make this process much easier.
Now that is sorted I have started at the point of installing everything fresh using the steps and files provided in post #2
Moving the file, using tar and applying the patch seems to work fine (files appear to transfer), but once ./install is used the following error occurs:
Code:
gcc -g -o cweave cweave.o common.o
ln: failed to create symbolic link 'cweave': File exists
ln: failed to create symbolic link 'ctangle': File exists
============================================================
* Build Stanford GraphBase
* Modified By Paul Shaiju (Paul S)
* Email-id : paultsr@gmail.com
* Website : http://paultsr.in
============================================================
Making sgb
gcc-4.8 -g -I/usr/local/sgb/include test_io.c gb_io.o -o test_io
make: gcc-4.8: Command not found
Makefile:108: recipe for target 'test_io' failed
make: *** [test_io] Error 127
Unable to create sgb library, but it's optional, so continuing...
============================================================
* Build GT-ITM
* Modified By Paul Shaiju (Paul S)
* Email-id : paultsr@gmail.com
* Website : http://paultsr.in
============================================================
sgb lib not found. gt-itm & sgb2ns could not be installed. Continuing..
============================================================
* Build zlib
* Modified By Paul Shaiju (Paul S)
* Email-id : paultsr@gmail.com
* Website : http://paultsr.in
============================================================
Building static library libz.a version 1.2.3 with gcc-4.8.
cp: preserving times for 'zconf.h': Operation not permitted
Checking for unistd.h... No.
Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()
Checking for snprintf() in stdio.h... No.
WARNING: snprintf() not found, falling back to sprintf(). zlib
can build but will be open to possible buffer-overflow security
vulnerabilities.
Checking for return value of sprintf()... No.
WARNING: apparently sprintf() does not return a value. zlib
can build but will be open to possible string-format security
vulnerabilities.
Checking for errno.h... No.
Checking for mmap support... No.
gcc-4.8 -O -DNO_snprintf -DHAS_sprintf_void -DNO_ERRNO_H -c -o example.o example.c
make: gcc-4.8: Command not found
<builtin>: recipe for target 'example.o' failed
make: *** [example.o] Error 127
Zlib make failed, but it's optional Continue ...
============================================================
* Build tcl8.5.10
* Modified By Paul Shaiju (Paul S)
* Email-id : paultsr@gmail.com
* Website : http://paultsr.in
============================================================
configure: WARNING: unrecognized options: --enable-gcc
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.8
checking whether the C compiler works... no
configure: error: in `/opt/ns-allinone-2.35/tcl8.5.10/unix':
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.Scriptics.com
to see if they have a fix for your platform.
I was unsure how much of the error was relevant so i tried to go up as far as i could.
This means ns has not installed correctly at all? I am not sure if i have missed anything else to do before the patch & ./install
Aside from the steps given here before i began i went through the standard steps i have gone through previous to get my unpatched version of ns-2.35 working:
Again im very sorry for the late response, and i hope the steps i have taken to start fresh and get this working are reasonable.
I have also still attached analysis.awk for you to take a look if you wish to do so.
I left it for a few minutes, checked my permissions (sudo chmod -R 777 FILENAME) everywhere i had been using, and retried ./install
Worked!
Tested the demo, no problem
Altered my files as you suggested (No changes to .awk) and the simulation has run sucessfully.
Currently nam is still playing up but i will follow your instructions to sort that (i also have a working version on my other VM copy so i can transfer files over to that one if needs be)
I was wondering if it would be okay for me to do one last final post on here, explaining every step i went through to get towards this stage? As i know i struggled so much i would like to leave a full tutorial with any fiddly bits in it people may not know they need to do
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513
Rep:
Re #8, #9.
Thank you for the awk script.
gcc-4.8 : $ apt-get install g++-4.8
Suggest a search when packages are wanted: $ apt-cache search gcc-4.8
Or on-line https://packages.ubuntu.com/search?s...searchon=names
Or install `synaptic´ package manager. Can search in all the 40,000 available packages.
About gt-itm/ :
ns-allinone-2.35_gcc5.tar.gz has an ns-allinone-2.36 version. Worked for a short time.
The current most usable gt-itm/ is found in ns-allinone-2.33 .
Quote:
chmod -R 777
Not a good idea to use opt/ for package builds.
Default / safe is /home/name/tmp/ ... and for ns2: /home/name/ns2/(protocol)
I.e. you are exposed for attacks whenever using sudo.
Quote:
... if it would be okay for me to do one last final post on here
You are always welcome to write about your results / issues.
gcc-4.8 : $ apt-get install g++-4.8
Suggest a search when packages are wanted: $ apt-cache search gcc-4.8
Or on-line https://packages.ubuntu.com/search?s...searchon=names
Or install `synaptic´ package manager. Can search in all the 40,000 available packages.
About gt-itm/ :
ns-allinone-2.35_gcc5.tar.gz has an ns-allinone-2.36 version. Worked for a short time.
The current most usable gt-itm/ is found in ns-allinone-2.33 .
Thankyou, have kept this noted for future reference.
Quote:
Not a good idea to use opt/ for package builds.
Default / safe is /home/name/tmp/ ... and for ns2: /home/name/ns2/(protocol)
I.e. you are exposed for attacks whenever using sudo.
Sorry I just need some clarity on this, when i install NS2 it is safer / better to place into directory /home/name/ns2 ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.