Aug 31, 2006

How to install the tcl-debug onto Cygwin + ns2 release 2.28

[ns] [Answer] How to install the tcl-debug onto Cygwin + ns2 release 2.28
tk424 tk424 at umr.edu
Thu Jun 16 10:23:08 PDT 2005

Dear NS-users,

I decided to email to share my experience how to install the tcl-debug2.0.
I've seen some emails from NS mailing list archive providing useful information.
I recommend you to try the STANDARD method to install tcl-debug suggested by
(1) the NS-manual, Chap. 22.1. Tcl-level debugging.
(2) the archive, Title: [ns] re:how to debug TCL by Jiangtao Luo (Nov.2004)
http://mailman.isi.edu/pipermail/ns-users/2004-November/045925.html
(3) The README file given by Tcl-debug

But I needed some more information and help to make my tcl-debug work.
The help is mostly from the other NS users in the archive, Regina Rosales Hain, and Prof. Larry Pyeatt.
By sharing my experience, some of you may save time and effort. :)
The method in this email is just one option and there are so many other (and easy) ways to deal with problems as well.

------------------------------------------------------------------------------------
Target:
Information about the installation of tcl-debugger for NS-2;
tcl-debug is suggested on the official NS-2 website.
I've got the same installation problem as minisivakumar vellore (Mar. 2005), which I didn't find the solution in the archive yet.

------------------------------------------------------------------------------------
Assumption:
Installation of Cygwin and NS-2 is successful.
(This email only deals with the installation of tcl-debug.)
Tcl-debug will be installed onto a directory parallel to the NS-2 directory, i.e. ~ns (by the convention in the NS manual)

------------------------------------------------------------------------------------
My system:
OS: Windows XP + Cygwin (http://www.cygwin.com/setup.exe)
(I guess the Cygwin DLL release version is 1.5.17-1 <http://cygwin.com/ml/cygwin-announce/2005-05/msg00029.html> )
NS-2: release 2.28 all-in-one package
(http://www.isi.edu/nsnam/dist/ns-allinone-2.28.tar.gz)
Tcl debugger: tcl-debug version 1.7
(http://expect.nist.gov/tcl-debug/tcl-debug.tar.gz)

NS-2 is installed on the user's home directory, /home/UserID;
therefore. /home/UserID/ns-allinone-2.28
------------------------------------------------------------------------------------
Refered links:
http://www.cygwin.com/
http://www.isi.edu/nsnam/ns/
http://mailman.isi.edu/pipermail/ns-users/

------------------------------------------------------------------------------------
Installation of tcl-debug

1. Download the tcl-debug and move the downloaded file to NS-2 root directory, i.e. ns-allinone-2.28.
To download, http://expect.nist.gov/tcl-debug/tcl-debug.tar.gz
You should be in the NS-2 root directory
$ cd /home/UserID/ns-allinone-2.28

UserID is your account. For example, the account name phil4u becomes /home/phil4u/ns-allinone-2.28

2. Extract the downloaded tcl-debug file.
$ tar -xfz tcl-debug.tar.gz

Then, the extracted files will be automatically copied into a new directory, tcl-debug-2.0
Note: The reason we extract the files into a directory PARALLEL to the directory ~ns,
i.e. /home/UserID/ns-allinone-2.28/ns-2.28, is because of the step 4.3.

3. Compile the tcl-debug and move the created loadable library to the NS-2 library directory
1) Move to the directory where tcl-debug is.
$ cd tcl-debug-2.0

2) Configure and compile tcl-debug
$ ./configure
$ make

3) Check whether a loadable library (*.a) is created after compilation.
See if a file "libtcldbg.a" is there.
As its name, this file is the loadable "library for tcl debug".

4) Copy the loadable library to the NS-2 library directory, /home/UserID/ns-allinone-2.28/ns-2.28/lib or ~ns/lib
$ cp *.a ../ns-2.28/lib

Note: After compilation, we don't get an executable file, but a loadable library.

4. Compile the NS-2
1) Go to the directory ~ns/lib and check whether the loadable library is properly copied.
$ cd ../ns-2.28/lib
$ ls

2) Move to the directory ~ns, /home/UserID/ns-allinone-2.28/ns-2.28
cd ..

3) Configure NS-2 with an option enabling tcl-debug
$ ./configure --with-tcldebug

Note: You should see lines showing that the directory of tcl-debug is recognized.
If you don't see this line below, you should get back to the previous steps.

Checking for libtcldbg... -L/home/UserID/ns-allinone-2.28/ns-2.28/ ../tcl-debug-2.0 -ltcldbg

I see this line above a line given below,

checking dmallc... not requested with --with-dmalloc

4) Erase previous compilation record
$ make clean

Note: This step is important!

5) Compile NS-2
$ make
Now the tcl-debug is embedded to the created NS-2 executable file "ns.exe" for cygwin

6) Check if you can run the NS-2 excutable.
$ ns
%
As you know, NS-2 works fine if you see %. ( Press ctrl+C )

7) Copy this NS-2 excutable to the ns-allinone-2.28/bin directory
$ cp ns.exe ../lib/

5. Check if the tcl-debug works.
Now the installation is done. You can check if the debugger works by adding a line "debug 1" into a tcl script.
For example,
1) pick a tcl script in ~ns/tcl/ex directory, say wireless-test.tcl,
and modify this tcl script with a text editor.

set ns_ [new Simulator]
debug 1; # this line calls the tcl-debug
set chan [new $opt(chan)]

2) Run the wireless-test.tcl
$ ns wireless-test.tcl

After running this script, you will see the following lines if the installation is successful.
2: lappend auto_path $dbg_library
dbg2.0>

If you still see the error message while you think you've done right so far, please check step 4.1, 4.3. 4.4, 4.6.
Good luck!

Tae-hyung Kim

tags :

No comments: