For gcc 4.0.3, ns-2.28 source codes are violating programming regulations. So, some files have to be manually modified to let "make" succeed.
Generally, the declaration of "class A" has to be put before a reference appears in another class definition. For example,
class B
{
A* aa;
....
}
Also, declaration as
static const double ALPHA_ = 0.4;in a header file, is illegal, because initialization of a static variable in header file would lead to multiple initializations occurred in all files including this header file.
So, it must be changed as :
static const double ALPHA_ // in header file const double XCPQueue::ALPHA_ = 0.4; // in cpp fileA list of paths are given as below: (copying from ns-mail list)
diff -ru ns-allinone-2.28.orig/nam-1.11/agent.h ns-allinone-2.28/nam-1.11/agent.h --- ns-allinone-2.28.orig/nam-1.11/agent.h 2001-06-15 21:53:10.000000000 -0400 +++ ns-allinone-2.28/nam-1.11/agent.h 2005-06-13 18:10:05.000000000 -0400 @@ -70,7 +70,7 @@ inline double width() {return width_;} inline double height() {return height_;} virtual void findClosestCornertoPoint(double x, double y, - double &corner_x, double &corner_y) const = NULL; + double &corner_x, double &corner_y) const = 0; virtual void place(double x, double y); void label(const char* name, int anchor); void color(const char* name); diff -ru ns-allinone-2.28.orig/ns-2.28/diffusion3/lib/nr/nr.hh ns-allinone-2.28/ns-2.28/diffusion3/lib/nr/nr.hh --- ns-allinone-2.28.orig/ns-2.28/diffusion3/lib/nr/nr.hh 2005-01-19 13:23:21.000000000 -0500 +++ ns-allinone-2.28/ns-2.28/diffusion3/lib/nr/nr.hh 2005-06-13 18:11:03.000000000 -0400 @@ -43,7 +43,8 @@ typedef signed int int32_t; #endif typedef signed short int16_t; -#if defined (sparc) +// #if defined (sparc) +#if defined (__SVR4) && defined (__sun) typedef char int8_t; #else // Conflicts with system declaration of int8_t in Solaris diff -ru ns-allinone-2.28.orig/ns-2.28/xcp/xcpq.cc ns-allinone-2.28/ns-2.28/xcp/xcpq.cc --- ns-allinone-2.28.orig/ns-2.28/xcp/xcpq.cc 2005-02-03 13:29:20.000000000 -0500 +++ ns-allinone-2.28/ns-2.28/xcp/xcpq.cc 2005-06-13 18:10:30.000000000 -0400 @@ -33,6 +33,15 @@ } class_droptail_xcpq; +const double XCPQueue::ALPHA_ = 0.4; +const double XCPQueue::BETA_ = 0.226; +const double XCPQueue::GAMMA_ = 0.1; +const double XCPQueue::XCP_MAX_INTERVAL= 1.0; +const double XCPQueue::XCP_MIN_INTERVAL= .001; + +const double XCPQueue::BWIDTH = 0.01; + + XCPQueue::XCPQueue(): queue_timer_(NULL), estimation_control_timer_(NULL), rtt_timer_(NULL), effective_rtt_(0.0), diff -ru ns-allinone-2.28.orig/ns-2.28/xcp/xcpq.h ns-allinone-2.28/ns-2.28/xcp/xcpq.h --- ns-allinone-2.28.orig/ns-2.28/xcp/xcpq.h 2005-02-03 13:29:20.000000000 -0500 +++ ns-allinone-2.28/ns-2.28/xcp/xcpq.h 2005-06-13 18:10:36.000000000 -0400 @@ -113,11 +113,11 @@ XCPTimer* rtt_timer_; double link_capacity_bps_; - static const double ALPHA_ = 0.4; - static const double BETA_ = 0.226; - static const double GAMMA_ = 0.1; - static const double XCP_MAX_INTERVAL= 1.0; - static const double XCP_MIN_INTERVAL= .001; + static const double ALPHA_ ; + static const double BETA_ ; + static const double GAMMA_ ; + static const double XCP_MAX_INTERVAL; + static const double XCP_MIN_INTERVAL; double Te_; // control interval double Tq_; @@ -141,7 +141,7 @@ double b_[BSIZE]; double t_[BSIZE]; int maxb_;alter - static const double BWIDTH = 0.01; + static const double BWIDTH; int min_queue_ci_; int max_queue_ci_;
Solution for another problem when install ns-2.28 in Debian
./configure: line 7068: ` OSF*)' tcl8.3.2 configuration failed! Exiting .
The problem is that there are superfluous "'" characters in unix/configure: grep in unix/configure for /etc/.relid and change it
from system=MP-RAS-`awk '{print }' /etc/.relid'` to system=MP-RAS-`awk '{print }' /etc/.relid` There are more occurrences of that line in tcl, tk and octcl with the same problem.
For gcc 4.1.1 or above, there is a lot of coding violations. The best way is to still use gcc-4.0 to compile, change Makefile:
CC = gcc-4.0 CPP = g++-4.0
No comments:
Post a Comment