Fedora notes

Friday, December 17, 2004

Ns2 Building Experiences

building ns2 in linux proves to be troublesome, especially with specific combination of the ns2 versions and os versions. more or less the problems lie in legacy issues of gcc and ns2 source. i collect here my personal experiences of building ns2 over a constantly upgrading linux systems in an "issue-with-patch" manner.

Ns2 version I used in all platforms: ns-2.1b6, tclcl-1.0b8, tcl8.0.4, tk8.0.4, otcl-1.0a4

Fedora Core 3 (gcc3.4.2):
1. compiling tclcl:
tclcl-mappings.h: In static member function `static int TclObjectHelper::dispatch_(void*, Tcl_Interp*, int, char**)':
tclcl-mappings.h:51: error: incomplete type `Tcl' used in nested name specifier
tclcl-mappings.h:52: error: invalid use of undefined type `struct Tcl'
tclcl-mappings.h:41: error: forward declaration of `struct Tcl'
tclcl-mappings.h:57: error: invalid use of undefined type `struct Tcl'
tclcl-mappings.h:41: error: forward declaration of `struct Tcl'
make: *** [Tcl.o] Error 1

[apply the following patch]
 #include "tclcl-config.h"

-#include "tclcl-mappings.h"
#include "tracedvar.h"
+// tclcl-mappings.h included below, AFTER definition of class Tcl

struct Tk_Window_;

@@ -158,6 +158,8 @@
Tcl_HashTable objs_;
};

+#include "tclcl-mappings.h"
+
class InstVar;

class TclObject {
2. compiling ns2:
locdbase.cc: In member function `virtual int LocDbase::command(int, const char* const*)':
locdbase.cc:67: error: array bound forbidden after parenthesized type-id
locdbase.cc:67: note: try removing the parentheses around the type-id
make: *** [locdbase.o] Error 1

[patch] locdbase.cc:67: table_ = new (MobileNode *)[nn_]; --> table_ = new MobileNode *[nn_];

./arp.h:126: error: `void ARPTable::arprequest(nsaddr_t, nsaddr_t, LL*)' is private
ll.h:82: error: within this context
make: *** [trace-ip.o] Error 1

solution: make the method "public"

Red Hat Linux 8:
1. "memcpy""memset""bcopy""bzero" declarations have collision in string.h
solution: comment the declaration of "bcopy" and "bzero" in /usr/include/string.h
2. "friend declaration requires class-key"
solution: add 'class'or 'struct' after keyword 'friend'
3. rap/utilities.h:59:9: "and" cannot be used as a macro name as it is an operator in C++, rap/utilities.h:60:9: "or" cannot be used as a macro name as it is an operator in C++
solution: comment "and" and "or" macro definition in file rap/utilities.h
4. some error message may be given like this: 'default argument is given after the specification ...', which means no need to specify default argument when implementing.
solution: remove the default value specified in the function implementation part.

3 Comments:

  • thanks good writting

    I use Red hat Enterprise kernel 2.6.9-5 EL , before i have been installed ns2.30 allinone with no problem but
    when I tried ./install in the ns-allinone 2.1b8 , I get problem like this. can you help me to fix it,

    tclcl-mappings.h:51: error: incomplete type `Tcl' used in nested name specifier
    tclcl-mappings.h :52: error: invalid use of undefined type `struct Tcl'
    tclcl-mappings.h:41: error: forward declaration of `struct Tcl'
    tclcl-mappings.h:57: error: invalid use of undefined type `struct Tcl'
    tclcl-mappings.h :41: error: forward declaration of `struct Tcl'
    make: *** [Tcl.o] Error 1
    tclcl-1.0b11 make failed! Exiting ...

    regards

    STTTelkom Student

    By Blogger adi, at 9:26 AM  

  • Finally I found someone fighting the same problems as I am. Could you please provide detailed instruction on how to apply the patch?

    Roger

    By Blogger Roger, at 4:51 PM  

  • Here is the solution:

    copy the next few lines in a file having the extension .patch

    --- tclcl.h~ 2003-07-29 11:24:50.000000000 -0700
    +++ tclcl.h 2004-12-10 08:55:34.692584936 -0800
    @@ -45,8 +45,8 @@
    }

    #include "tclcl-config.h"
    -#include "tclcl-mappings.h"
    #include "tracedvar.h"
    +// tclcl-mappings.h included below, AFTER definition of class Tcl

    struct Tk_Window_;

    @@ -158,6 +158,8 @@
    Tcl_HashTable objs_;
    };

    +#include "tclcl-mappings.h"
    +
    class InstVar;

    class TclObject {

    After having done so, apply this patch to the tclcl.h file by writting the following line in the terminal:

    patch tclcl-1.0b8/tclcl.h tclcl-1.0b8/tclcl.patch

    The patch is applied by writing the comand "patch" and then writing the file that you want to patch here it is "tclcl-1.0b8/tclcl.h" and then writing the patch file that you created copying the above coding lines here it is named "tclcl.patch"
    Hope everything is clear, if you have any problem applying this you are welcome to contact me: s_l_h_3@yahoo.es

    Good luck

    By Blogger wannalearn, at 10:12 AM  

Post a Comment

<< Home