Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i have added the path to where i have saved my tcl script (i.e. where ns2 is installed in home/me/ns-allinone-2.35). i have created a .bashrc and .bash_profile too, since they were not there.

In bashrc i have given the following path:

  $PATH=PATH:/home/me/ns-allinone-2.35

in bash_profile the following:

  if [ -f ~/.bashrc ]; then source ~/.bashrc fi

now when i type in my terminal:

  ns ns-simple-trace.tcl 

i get the error:

  o: command not found
  bash:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/me/ns-allinone-2.35: No such file or directory

what should i do to get my 'ns-simple-trace' script running?

share|improve this question
    
What do you get when you just type ns ? –  mok Mar 18 at 16:15
    
i get a % sign. –  pythonspark Mar 18 at 16:25
    
copy a sample tcl file into ns-allinone-2.35/ns-2.35 and try this: ./ns filename.tcl. Does it work? –  mok Mar 18 at 17:04
    
no it says: bash: ./ns: No such file or directory –  pythonspark Mar 18 at 18:34
    
i changed the path in .bashrc for this too to home/me/ns-allinone-2.35/ns-2.35 –  pythonspark Mar 18 at 18:53

1 Answer 1

up vote 0 down vote accepted

Installation of ns2 is a little tricky and I think you've not installed it correct.

Try this :

1 :

Before install NS2, you have to install some essential softwares:

sudo apt-get install tcl8.5-dev tk8.5-dev
sudo apt-get install build-essential autoconf automake
sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev

2 :

Download NS2 source file (“ns-allinone-2.35.tar.gz“)

3 :

Unpack ns-allinone-2.35.tar.gz to your home directory. (/home/abc is my home directory, you SHOULD change it to your own!)

tar -zxvf ns-allinone-2.35.tar.gz -C /home/abc

4 :

Modify the makefile

gedit /home/abc/ns-allinone-2.35/otcl-1.14/Makefile.in

Change CC = @CC@ to CC = @CC@ -V 4.5

(NOTICE the V is capital.)

5 :

Install NS2:

cd /home/abc/ns-allinone-2.35
sudo ./install

6 :

Modify .bahrc

gedit /home/abc/.bashrc

Go to the last line and add the scripts below:

export PATH=$PATH:/home/abc/ns-allinone-2.35/bin:/home/abc/ns-allinone-2.35/tcl8.5.10/unix:/home/abc/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/abc/ns-allinone-2.35/otcl-1.14:/home/abc/ns-allinone-2.35/lib
export TCL_LIBRARY=$TCL_LIBRARY:/home/abc/ns-allinone-2.35/tcl8.5.10/library

Enable the path setting:

cd /home/abc source .bashrc

share|improve this answer
    
i have reinstalled it, but u have a slight problem, how should i remove the previous ns from usr/bin? i cant delete it from that place directly. How can i use the terminal to do it? –  pythonspark Mar 18 at 21:55
    
this 'ns' is in the filesystem and not in my home directory. but when i type which ns it gives usr/bin/ns instead of: /home/me/ns-allinone-2.35/bin/ns –  pythonspark Mar 18 at 22:06
    
I cannot test to see if after installation his way my tcl script is running because of the duplicate ns in my filesystem. But this installation procedure is correct. Thanks. –  pythonspark Mar 19 at 13:44
    
@pythonspark- You're welcome, sorry it was late in my country. I'm a little confused about the other ns installation that you say, cause indeed another installation shouldn't interfere. –  mok Mar 19 at 14:18
    
can u please help with two errors that i am getting gcc: error: unrecognized command line option ‘-V’ gcc: error: 4.5: No such file or directory. this happens at step 5 when i ./install. it says: make: *** [libotcl.a] Error 1 otcl-1.14 make failed! Exiting ... –  pythonspark Mar 19 at 22:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.