LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   bash: ns: command not found using ns-2.31 (https://www.linuxquestions.org/questions/linux-software-2/bash-ns-command-not-found-using-ns-2-31-a-831390/)

Vixxx 09-10-2010 09:39 AM

bash: ns: command not found using ns-2.31
 
Hey,

After installing ns-2.34, evtg worked fine, however I wanted to install the crcn (cognitive radio) add-on I had a lot of prablem in the Makefile.in. However the crcn is tested till ns-2.31. I installed ns-2.31 but after installation I cannot use ns. It doesn't enter to the program. It gives me this msg:

The program 'ns' is currently not installed. You can install it by typing:
apt-get install host
bash: ns: command not found

however doing apt-get install host is not the solution, it install another kind of command.

I don't also think the problem is from the path because I added this and still not working:

NS=/home/victor/Desktop/NS2-2.31/ns-allinone-2.31/ns-2.31/
NAM=/home/victor/Desktop/NS2-2.31/ns-allinone-2.31/nam-1.13/
export PATH=$PATH:$NS:$NAM


Maybe I got the PATH wrong or smtg. What to do ? Any ideas?

Thank you!

rcbrgs 09-10-2010 10:14 AM

You could be absolutely sure the program is installed if you run it with the full path, such as:

/home/victor/Desktop/NS2-2.31/ns-allinone-2.31/ns-2.31/ns

I'm guessing the path - I have never used this program specifically.

To find the correct path, you should "find" it. Supposing the file is in the $NS directory, do:

find $NS -name "ns"

And this should return the specific location of the ns file, if it is inside the $NS directory. Try running it, and if there is an error, please post it here.

Vixxx 09-10-2010 10:47 AM

Hey,

The ns worked, I dunno exactly how it worked, but when I run the gnome-terminal it worked. and when I enter the directory, and run ./ns it also go to %.

Anyway I have a new problem, I think due to nam 1.13. The error given:

nam:
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D / 120) * 4}] units
}"
invoked from within
"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox <MouseWheel> {
%W yview scroll [expr {- (%D)}] units
}
bind Li..."

What to do? Any ideas?

Thank you

rcbrgs 09-10-2010 10:54 AM

I found this thread for Fedora, see if applying the patches solves your problem:

http://forums.fedoraforum.org/showthread.php?t=206795

Vixxx 09-10-2010 11:32 AM

Yes, I think that worked fine. Thanks

sktimalsina 11-08-2010 03:35 AM

Problem with Makefile
 
Hi,

I am new user of ns2 and want to simulate the Cognitive Radio MAC protocols like SYN-MAC and C-MAC.

Therefore, I decided to try the CRCN patch.

But on the step5 of stuweb.ee.mtu.edu/~ljialian/installation.htm , they have not mentioned about pasting the given lines on which lines of Makefile
of ns2 folder.

So, If I'd paste it on whichever location, I got error message while doing 'make clean' and 'make'.
After this, my ns command also stops working.

Could you please help me with this problem please.

knudfl 11-08-2010 01:15 PM

@ sktimalsina, post # 6 : Welcome to LQ. .. .. :) ..

CRCN : http://stuweb.ee.mtu.edu/~ljialian/installation.htm

Some more informations will be nice ( Every time you ask a question.)
http://www.linuxquestions.org/linux/...Ask_a_Question
http://www.catb.org/~esr/faqs/smart-questions.html
1) The version of ns-allinone.2.XX, please.
2) The Linux OS, you are using, like Fedora 13, Ubuntu 10.10 etc.
.......

sktimalsina 11-08-2010 07:36 PM

Problem on Makefile for crcn patch in ns2
 
Hi,

Thanks for the response.

I am using Ubuntu 10.04 OS.

ns version is : ns 2.34.

I have installed the ns2 (all in one) in my home directory.

Hope this could help to identify and resolve my problem.

Thank you and looking forward to hear from you.

Sunil

knudfl 11-09-2010 01:33 PM

1 Attachment(s)
The crcn patch is for ns-2.31 > > ns-allinone-2.31.
It didn't work in ns-2.34.

The four (not three) new Makefile lines :
I added them to Makefile.in instead.
Some editing is required : Each line has 8 spaces : Not allowed.
Replaced by one <TAB>. Location : Line 311-312-313-314.
Please rename Makefile (if present) to Makefile.old, then :
1) export CC=gcc-4.1 CXX=g++-4.1
2) ./configure && make clean && make depend && make
... and you have a "CRCN ns".

The attached Makefile.in.txt : Rename to Makefile.in
..

sktimalsina 11-10-2010 02:01 AM

Hi,

Thank you for your reply.

I removed ns allinone 2.34 and extracted 2.31 in my home directory (/home/sunil/).
Then I extracted the files of crcn.zip into ns-2.31 folder (with overwriting existing files).
I renamed makefile and Makefile.in in ns-2.31 folder to makefile.old and Makefile.in.old respectively
Then I saved the Makefile.in.txt provided by you on the ns-2.31 folder as Makefile.in .
After this, I did export CC = gcc-4.3 (My gcc verson, hope this doesn't matter)

Then I ran ./install which completed.

After this, I tried to run CRCN.jar which worked for some and did not for others. However, I don't find CRCN.jar handy.

Is this method correct? I am not sure because I cannot device a code to validate it.

Could you please provide me any simple sample code for Cognitive Radio MAC protocol if you have any. (or perhaps any web link where I could learn)

Anyway, I am very very much thankful for your support.

Thank you again,
Sunil :)

knudfl 11-10-2010 03:54 PM

# 10 :
Quote:

Is this method correct? I am not sure because I cannot device a code to validate it.
Looks OK ( except "cannot device a code" isn't understandable.)
..
..
Google .. ns2 Cognitive Radio MAC protocol ..
http://www.google.com/webhp#hl=da&bi...cb92d68081299a

Example
http://www.2dix.com/pdf-2010/cogniti...ng-ns2-pdf.php

.. And there are 6.000 more hits.
..

Gunasekaran 12-30-2011 03:01 AM

installation &validation failed in ns2.31 on ubuntu 10.04 lucid
 
nstallation &validation failed in ns2.31 on ubuntu 10.04 lucid
@ knudfl sir,

Actually me and my friends trying to install ns2.31 on ubuntu 10.04 since 1 month but not good results came yet.this is the error came when i install and validate....

error occur while ./install

checking for XShmAttach in -lXext... yes
checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/bin/install -c
checking system version (for dynamic loading)... Linux-2.6.32-33-generic
No explicit static compilation flag; setting V_STATIC to ""
checking for dlopen in -ldl... yes
checking for a BSD-compatible install... /usr/bin/install -c
configure: creating ./config.status
config.status: creating Makefile
rm -f libotcl.so otcl.o so_locations
gcc-4.3 -c -g -O2 -DNDEBUG -DUSE_SHM -fpic -I. -I/home/guna/ns-allinone-2.31/include -I/home/guna/ns-allinone-2.31/include -I/home/guna/ns-allinone-2.31/include -I/include otcl.c
make: gcc-4.3: Command not found
make: *** [libotcl.so] Error 127
otcl-1.13 make failed! Exiting ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
guna@ubuntu:~/ns-allinone-2.31$

error occur while ./validate

Running test full-asymmetric:
../../ns test-suite-delaybox.tcl full-asymmetric QUIET
./test-all-template1: 149: ../../ns: Too many levels of symbolic links
Test not implemented
All test output agrees with reference output.
Fri Dec 30 12:22:30 IST 2011
These messages are NOT errors and can be ignored:
warning: using backward compatibility mode
This test is not implemented in backward compatibility mode

validate overall report: some tests failed:
./test-all-simultaneous
to re-run a specific test, cd tcl/test; ./test-all-TEST-NAME
Notice that some tests in webcache will fail on freebsd when -O is turned on.
This is due to some event reordering, which will disappear when -g is turned on.
guna@ubuntu:~/ns-allinone-2.31/ns-2.31$ source ~/.bashrc
guna@ubuntu:~/ns-allinone-2.31/ns-2.31$ ns
ns: command not found
guna@ubuntu:~/ns-allinone-2.31/ns-2.31$

sir,

i used so many different installation steps all is failed, currently i used this steps......

How to install NS2 with Ubuntu 10.04 By Noor Zaman

This manual will work for NS2 allinone-2.34 with Ubuntu 10.4. As Ubuntus new version 10.04 needs following packages before any further installation, otherwise it will not work with it.
Please follow the following steps:

1. Install necessary tools for building:

sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.3

2. It turns out that otcl does not like the version of gcc installed by default in Lucid. So go ahead and change ns-allinone-2.34/otcl-1.13/Makefile.in. Find the line that says:

CC= @CC@
and change it to:
CC= gcc-4.3
3. Now follow the following steps for installation of nsallinone 2.34 and it will work with your machine. (copy ns-allinone-2.34.tar.gz)

Suppose that there is "ns-allinone-2.33.tar.gz" in current directory (e.g. "~/" for me is "/home/noor").
All steps are done in Terminal, so open a terminal in Accessories/Terminal.To extract the file:
tar xvfz ./ns-allinone-2.33.tar.gz


4. Change your directory within terminal as following way

$ cd /home/noor$ cd /home/noor/ns-allinone-2.34

5. Download & install some packages from repository if needed (Now its optional)

$ sudo apt-get install build-essential autoconf automake libxmu-dev
6. Install the ns2

$ cd ns-allinone-2.34
$ ./install
7. Edit some paths

$ gedit ~/.bashrc
8. Put these lines on that file in the last. Off course, you might change /home/noor for it depends on where you extract ns-allinone-2.34.tar.

# LD_LIBRARY_PATHOTCL_LIB=/home/noor/ns-allinone-2.34/otcl-1.13NS2_LIB=/home/noor/ns-allinone-2.34/libX11_LIB=/usr/X11R6/libUSR_LOCAL_LIB=/usr/local/libexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB# TCL_LIBRARYTCL_LIB=/home/noor/ns-allinone-2.34/tcl8.4.18/libraryUSR_LIB=/usr/libexport TCL_LIBRARY=$TCL_LIB:$USR_LIB# PATHXGRAPH=/home/noor/ns-allinone-2.34/bin:/home/noor/ns-allinone-2.34/tcl8.4.18/unix:/home/noor/ns-allinone-2.34/tk8.4.18/unix:/home/noor/ns-allinone-2.34/xgraph-12.1/NS=/home/noor/ns-allinone-2.34/ns-2.34/NAM=/home/noor/ns-allinone-2.34/nam-1.13/export PATH=$PATH:$XGRAPH:$NS:$NAM

9. Validate it (take very long time compare to install process)
$ cd ns-2.33$ ./validate

10. Let it take effect immediately

$ source ~/.bashrc

11. Try to run it as following way, by just typing ns with terminal

$ ns
12. If the installation is successful, then you will be able to see % at the command prompt. Type following command to exit
% exit

13. Good luck and please keep remember me in your prays(Thanks in advance). Noor Zaman, King Faisal University, Saudi Arabia.


sir pls help me...thanks in advance.....

knudfl 12-31-2011 10:09 AM

#12, @Gunasekaran : sudo apt-get install g++-4.1

Installing ns-allinone-2.31 :
cd ns-allinone-2.31/ && export CC=gcc-4.1 CXX=g++-4.1 && ./install

Quote:

7. Edit some paths
$ gedit ~/.bashrc
.
.
10.
$ source ~/.bashrc
Not required.
And will make 'ns' functions impossible when you have more than one version of ns-allinone-2.xx.
'ns' and 'nam' are hard coded to know where their libraries are located.
And : 'cd ns-allinone-2.31/ns-2.31/ && sudo make install' copies ns to /usr/local/bin/ .
The same for 'nam'. Then both binaries are in a "system PATH".

..

Gunasekaran 01-26-2012 02:05 AM

handoff
 
hi sir

I am doing project on NEMO handoff by using AODV.

1. how to find the shortest path between the nodes for transferring a packet..

2. how to maintain table in the particular node..because for my project i have to maintain nested level of the mobile nodes...

werocks 03-08-2012 06:58 AM

Hello,
I am running ns-allinone-2.35 (downloaded from sourceforgenet) on ubuntu 10.10. My ns is working properly. However when i try to run nam, its showing the following error:

$ nam
nam: Can't find a usable tk.tcl in the following directories:
$HOME/ns-allinone-2.35/tcl8.5.10/library/tk8.5 $HOME/ns-allinone-2.35/tcl8.5.10/tk8.5 ./lib/tk8.5 $HOME/ns-allinone-2.35/lib/tk8.5 ./library

$HOME/ns-allinone-2.35/lib/tk8.5/tk.tcl: wrong # args: should be "::source fileName"
wrong # args: should be "::source fileName"
while executing
"::source -encoding utf-8 $HOME/ns-allinone-2.35/lib/tk8.5/msgs/en.msg"
("uplevel" body line 1)
invoked from within
"uplevel 1[list ::source -encoding utf-8 $langfile]"
(procedure "::msgcat::mcload" line 10)
invoked from within
"::msgcat::mcload [file join $::tk_library msgs]"
(in namespace eval "::tk::msgcat" script line 23)
invoked from within
"namespace eval msgcat {
namespace export mc mcmax
if {[interp issafe] || [catch {package require msgcat}]} {
# The msgcat package..."
(in namespace eval "::tk" script line 3)
invoked from within
"namespace eval ::tk {
# Set up the msgcat commands
namespace eval msgcat {
namespace export mc mcmax
if {[interp issafe] || [catch {p..."
(file "$HOME/ns-allinone-2.35/lib/tk8.5/tk.tcl" line 21)
invoked from within
"source.orig $HOME/ns-allinone-2.35/lib/tk8.5/tk.tcl"
("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 $HOME/ns-allinone-2.35/lib/tk8.5/tk.tcl"
("uplevel" body line 1)
invoked from within
"uplevel #0[list source $file]"


This probably means that tk wasn't installed properly.


However, when I double click on the executable inside $HOME/ns-allinone-2.35/bin the nam is opening.
What could be the problem.
PS: I have set all the environment variable as directed after the ./install
Thank you.


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