LAB Log

Contents:


ns2 -- Network Simulator


Fixing ns-2 Installation Problem 

Disclaimer: This log is initially intended to be used inside my research group, in particular between me and my supervisor only. Anyway, I am glad that this log is useful to several visitors. However, I am very hectic with my research and probably not the right person that you would ask about ns2 installation problems. It would be better to post the questions to ns-2 mailing list. I also ask a few questions there. Anyway, I normally answer sensible e-mails when I have some slots. For any comments or any mistakes spotted, please e-mail me. It would be very appreciated.

General note: ns-2 is compiled smoothly by gcc.2.9x.x included with the old version of Linux OS. However, for gcc 3.x.x, included with Redhat version 7 (up), there are several errors. I log quite a few of them here (that would be most of errors). 

Install ns2.1b6a with REDHAT 6 or Mandrake 7.1 (linux kernel 2.2.xx)

Install Ns2.1b6a on REDHAT 7.1, 8 (linux kernel 2.4.xx)

1. tracedvar.cc compile error 

gcc -c -O2 -DNO_TK -DNDEBUG -DUSE_SHM -DHAVE_LIBOTCL1_0A4 -DHAVE_OTCL_H
-DHAVE_LIBTK8_0 -DHAVE_TK_H -DHAVE_LIBTCL8_0 -DHAVE_TCL_H -DSTDC_HEADERS=1
-DHAVE_STRING_H=1 -DHAVE_SNPRINTF=1 -DHAVE_STRTOQ=1 -DHAVE_STRTOLL=1
-DSIZEOF_LONG=4 -DHAVE_INT64=1 -DHAVE_TCL_H=1 -DHAVE_LIBTCL8_0=1
-DHAVE_TK_H=1 -DHAVE_LIBTK8_0=1 -DHAVE_OTCL_H=1 -DHAVE_LIBOTCL1_0A4=1 -I.
-I/ns-allinone-2.1b6/otcl-1.0a5 -I/ns-allinone-2.1b6/tkbox/include -I/ns-allinone-2.1b6/tclbox/include -o tracedvar.o tracedvar.cc
tracedvar.cc: In method `char *TracedInt::value (char *, int)':
tracedvar.cc:102: `abort' undeclared (first use this function)
tracedvar.cc:102: (Each undeclared identifier is reported only once for
each function it appears in.)
make: *** [tracedvar.o] Error 1

2. friend declaration requires class-key compile error 

-I/home/csunix/nuk/ns-allinone-2.1b6/otcl-1.0a5
-I/home/csunix/nuk/ns-allinone-2.1b6/tkbox/include
-I/home/csunix/nuk/ns-allinone-2.1b6/tclbox/include -o trace.o trace.cc
In file included from trace.cc:44: tfrc.h:112: friend declaration requires
class-key, i.e. `friend class
TfrcSendTimer' tfrc.h:113: friend declaration requires class-key, i.e.
`friend class  TfrcNoFeedbackTimer' make: *** [trace.o] Error 1 Ns make failed!

3. 'strcasestr' function in ~/ns-allinone-2.1b6/ns-2.1b6/indep-utils/webtrace-conv/ucb/utils.h conflicts with /usr/include/string.h

      utils.h:110: declaration of C function `const char* strcasestr(const char*, const char*)' conflicts with
    /usr/include/string.h:183: previous declaration `char* strcasestr(const char*, const char*)' here
    make[1]: *** [logparse.o] Error 1
    make[1]: Leaving directory `/home/cserv1_a/pg/nuk/ns-allinone-2.1b6/ns-2.1b6/indep-utils/webtrace-conv/ucb'
    make: *** [all-recursive] Error 2  

4. argument casting in utils.cc

c++ -c  -I. -I/home/csunix/nuk/ns-allinone-2.1b6/tclcl-1.0b9 -I/home/csunix/nuk/
ns-allinone-2.1b6/otcl-1.0a5 -I/home/csunix/nuk/ns-allinone-2.1b6/tkbox/include                -I/home/csunix/nuk/ns-allinone-2.1b6/tclbox/include -o utils.o utils.cc
utils.cc: In function `int saccept(int)':
utils.cc:360: cannot convert `int*' to `socklen_t*' for argument `3' to
`int accept(int, sockaddr*, socklen_t*)'
utils.cc: In function `int sportnum(int)':
utils.cc:471: cannot convert `int*' to `socklen_t*' for argument `3' to
`int getsockname(int, sockaddr*, socklen_t*)'
make[1]: *** [utils.o] Error 1
make[1]: Leaving directory `/home/cserv1_a/pg/nuk/ns-allinone-2.1b6/ns-2.1b6/indep-utils/webtrace-conv/ucb'
make: *** [all-recursive] Error 2
Ns make failed!            

5. gt-itm make failed 

gcc  -I../include -L../lib  -DFBSD -o ../bin/itm itm.o geog.o ts.o dfs.o -lm -lgb
gcc  -I../include -L../lib  -DFBSD -o ../bin/sgb2alt sgb2alt.o  -lm -lgb
gcc  -I../include -L../lib  -DFBSD -o ../bin/edriver edriver.o eval.o -lm -lgb
gcc: eval.o: No such file or directory
make: *** [edriver] Error 1

            "edriver is used to compute properties of the generated graphs like average node degree, diameter etc.
              I think its presence is not essential for the correct running of gt-itm.
"   (Satish Kumar said in ns2 mailing list)

6. nam make failed according to paint.h

In file included from netview.cc:48:
paint.h:70: declaration does not declare anything
paint.h:70: parse error before `^' token
paint.h:71: semicolon missing after declaration of `Paint'
paint.h:71: parse error before `private'
paint.h: In static member function `static Paint* Paint::instance()':
paint.h:58: `instance_' undeclared (first use this function)
paint.h:58: (Each undeclared identifier is reported only once for each function it appears in.)
paint.h: In member function `_XGC* Paint::paint_to_gc(int)':
paint.h:60: `gctab_' undeclared (first use this function)
paint.h: In member function `int Paint::num_gc()':
paint.h:61: `ngc_' undeclared (first use this function)
paint.h: In member function `rgb* Paint::paint_to_rgb(int)':
paint.h:62: `rgb_' undeclared (first use this function)
paint.h: In member function `int Paint::thick()':
paint.h:68: `thick_' undeclared (first use this function)
paint.h: In member function `int Paint::thin()':
paint.h:69: `thin_' undeclared (first use this function)
paint.h: At global scope:
paint.h:71: parse error before `:' token
paint.h:74: `Paint*instance_' used prior to declaration
paint.h:75: `int ngc_' used prior to declaration
paint.h:77: `_XGC**gctab_' used prior to declaration
paint.h:78: `rgb*rgb_' used prior to declaration
paint.h:79: `int thick_' used prior to declaration
paint.h:80: `int thin_' used prior to declaration
paint.h:83: parse error before `}' token
make: *** [netview.o] Error 1
Nam make failed! Continue ...

7. nam make failed according to nam_stream.cc

c++ -o nam_stream.o -c  -DTCL_TK  -DNDEBUG -DUSE_SHM -DHAVE_LIBTCLCL1_0B8 -DHAVE_TCLCL_H
-DHAVE_LIBOTCL1_0A4 -DHAVE_OTCL_H -DHAVE_LIBTK8_0 -DHAVE_TK_H -DHAVE_LIBTCL8_0 -DHAVE_TCL_H
-DHAVE_LIBZ1_1_3 -DHAVE_ZLIB_H  -I. -I../tclcl-1.0b9 -I../otcl-1.0a5 -I../tkbox/include -I../tclbox/include -I../zlib-1.1.3  nam_stream.cc
nam_stream.cc:33: declaration of C function `double atof()' conflicts with
/usr/include/stdlib.h:137: previous declaration `double atof(const char*)' here
make: *** [nam_stream.o] Error 1
Nam make failed! Continue ...

8. Compile error of 'proxytrace.cc'

c++ -c  -I. -I/home/csunix/nuk/ns-allinone-2.1b6/tclcl-1.0b9 -I/home/csunix/nuk/ns-allinone-2.1b6/otcl-1.0a5 
-I/home/csunix/nuk/ns-allinone-2.1b6/tkbox/include -I/home/csunix/nuk/ns-allinone-2.1b6/tclbox/include -o proxytrace.o proxytrace.cc
proxytrace.cc: In function `size_t ReadHeader(FILE*, void*)':
proxytrace.cc:86: `exit' undeclared (first use this function)
proxytrace.cc:86: (Each undeclared identifier is reported only once for each function it appears in.)
make[1]: *** [proxytrace.o] Error 1

9. Compile error of my-endian.cc

c++ -c  -I. -I/home/csunix/nuk/ns-allinone-2.1b6/tclcl-1.0b9 -I/home/csunix/nuk/ns-allinone-2.1b6/otcl-1.0a5         -I/home/csunix/nuk/ns-allinone-2.1b6/tkbox/include -I/home/csunix/nuk/ns-allinone-2.1b6/tclbox/include -o my-endian.o my-endian.cc
my-endian.cc: In function `void ToOtherEndian(TEntry*)':
my-endian.cc:42: cannot convert `short unsigned int' to `method_t' in assignment
my-endian.cc:45: cannot convert `u_4bytes' to `method_t' in assignment
my-endian.cc:48: cannot convert `short unsigned int' to `protocol_t' in assignment
my-endian.cc:51: cannot convert `u_4bytes' to `protocol_t' in assignment
make: *** [my-endian.o] Error 1

10.  Compile error in ~/ns-allinone-2.1b6/tclcl-1.0b9 grumbling about embedded-tcl.cc

 ... 
 rm -f embedded-tcl.cc 
 ./tcl2c++ et_tcl ../tclbox/lib/tcl8.0/init.tcl ../tclbox/lib/tcl8.9/histrory.tcl 
 ../tclbox/lib/tcl8.0/word.tcl ../tclbox/lib/tcl8.0/http2.0/http.tcl  embedded-tcl.cc > ./tcl2c++
: error in loading shared libraries  libstdc++-libc6.1-2.so.3: cannot open shared object file
: No such file or directory 
 make: *** [embedded-tcl.cc] Error 127 
 tclcl-1.0b9 make failed! Exiting ... 
$ cd ~/ns-allinone-2.1b6/tclcl-1.0b9
$ make

11.  Compile error in '~/ns-allinone-2.1b6/ns-2.1b6/indep-utils/cmu-scen-gen/setdest'

      `/home/cserv1_a/pg/nuk/ns-allinone-2.1b6/ns-2.1b6/indep-utils/cmu-scen-gen/setdest'
    bgcc -o setdest setdest.o rng.o -Dstand_alone \ -lnsl -ldl -lm setdest.o: In
    function `init()': setdest.o(.text+0x8c): undefined reference to `operator
    new[](unsigned)' setdest.o(.text+0x106): undefined reference to `operator
    delete[](void*)' setdest.o(.text+0x12d): undefined reference to `operator
    delete[](void*)' setdest.o(.text+0x16b): undefined reference to `operator
    new[](unsigned)' setdest.o(.text+0x1d7): undefined reference to `operator
    new[](unsigned)' setdest.o: In function `main': setdest.o(.text+0x45a):
    undefined reference to `operator new(unsigned)' setdest.o(.text+0x49a):
    undefined reference to `operator delete(void*)' setdest.o(.text+0x4bf):
    undefined reference to `operator delete(void*)' setdest.o: In function
    `Node::Node()': setdest.o(.text+0x9ac): undefined reference to `operator
    new[](unsigned)' setdest.o: In function `Node::Node()':
    setdest.o(.text+0xc3c): undefined reference to `operator new[](unsigned)'
    setdest.o: In function `__FRAME_BEGIN__': setdest.o(.eh_frame+0x12):
    undefined reference to `__gxx_personality_v0' rng.o: In function
    `__FRAME_BEGIN__': rng.o(.eh_frame+0x11): undefined reference to
    `__gxx_personality_v0' collect2: ld returned 1 exit status

    make[1]: *** [setdest] Error 1
    ******************************

12. Popular error of recompiling ns2 and 'undefined reference to'

    c++ -o ns \
    tclAppInit.o random.o rng.o ranvar.o misc.o timer-handler.o scheduler.o
    /home/csunix/nuk/ns-allinone-2.1b6/tcl8.0.4/unix/libtcl8.0.a(tclUnixPipe.o): In
    tclUnixPipe.o(.text+0xcd): the use of `tmpnam' is dangerous, better use `mkstemp
    tclAppInit.o: In function `Tcl_AppInit':
    tclAppInit.o(.text+0x40): undefined reference to `operator new(unsigned)'
    tclAppInit.o(.text+0x7a): undefined reference to `operator delete(void*)'
    tclAppInit.o(.text+0x8b): undefined reference to `_Unwind_Resume'
    tclAppInit.o(.text+0x9c): undefined reference to `operator delete(void*)'
    tclAppInit.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0
    ..................

        and a lot of errors about 'undefined reference to' several things..........

     #setenv  LD_LIBRARY_PATH ~/ns-allinone-2.1b6/otcl-1.0a5:/usr/local/lib 

          Then, restart your session; recompile; and set the environment variable back.

13.  Further note is logged in  "~/ns-allinone-2.1b6/NukCompile/compile.log"

Install Ns2.1b8a on REDHAT 7.1, 8 (linux kernel 2.4.xx)

1. gt-itm make failed

2. friend declaration requires class-key compile error

3. link error of route.h


ERA -- Explicit Rate Adjustment 


Thai ns2 Users

If you are Thai (in Thailand or staying abroad) and you are using ns2 for your research or for your teaching/studying, I would really like to hear from you. What are you doing with ns2 and how long have you been using ns2? What do you think about using ns2 for Networking Course in Thailand? Is it interesting to set up a FORUM for ns2 users in Thailand? Or, there is already one? Please e-mail me.


I'm a great believer in luck and I find that "the harder I work the more I have it" -- Thomas Jefferson (1743-1826)

Back to Research Page

Back to Home Page

Last updated :  June 2003. By .. Somnuk Puangpronpitag