View Full Version : install ns-2 on fedora 14

22nd November 2010, 11:41 AM
i want to install ns-allinone-2.34 on fedora 14 bat i see this
error on terminal

tools/ranvar.cc: in member function `virtual double gammarandomvariable::value()':
tools/ranvar.cc:219:70: error: cannot call constructor `GammaRandomVariable::GammaRandomVariable'
tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant
make: *** [tools/ranvar.o] Error 1
ns make failed

i would be glad if any one help me

22nd November 2010, 12:54 PM
You typically need tools installed to build programs. Have you installed packages such as 'Development Tools', gcc, kernel-devel,kernel-headers, etc? Where did you get ns-allinone?

23rd November 2010, 07:52 AM
yes i install this packeges

23rd November 2010, 08:39 AM
it looks like the code is to old for the VERY new version of the gcc compiler ( gcc 4.5 )
you might need to install gcc 4.3 or gcc 4.1 alongside your current

to see what version you have installed run

gcc -v
the other versions are in the fedora repo

then you need to decide on just HOW you set the system to use them

the "alternatives" way
the set bash script way ( this is what i use to set [ gcc 3.4,4.1,4.3,4.5beta] on my system
or from the terminal at compile time ( dose not work well for BIG and complex programs)

ALSO as to what the forum administrator asked
WHERE did you get the program from ?
a prebuilt should?? be in the fedora reops
the std fedora repo or rpmfusion

7th December 2010, 06:48 AM
there were many changes in gcc 4.5.
as error message says, remove ::GammaRandomVariable.
simple patch

sed "s/GammaRandomVariable::GammaRandomVariable/GammaRandomVariable/g" -i tools/ranvar.cc

7th December 2010, 12:04 PM
there were many changes in gcc 4.5.
as error message says, remove ::GammaRandomVariable.
simple patch

sed "s/GammaRandomVariable::GammaRandomVariable/GammaRandomVariable/g" -i tools/ranvar.cc

can you explian more
i am a begginer in linux

7th December 2010, 12:22 PM
instead of editing code for the VERY VERY VERY new gcc 4.5 ,not many programs will build with it yet .
Too many changes were added for even slightly older code to build
you could port the program to build with it , and - hopefully- there will not be much hacking not likely
install the bit older gcc 4.3 and/or gcc 4.1
they are in the fedora repo
-- but things like this ARE WHAT you get when you use a bloody cutting edge R&D distro like fedora .
the OS is SO NEW that the rest of the world has not caught up to it yet .

7th December 2010, 01:53 PM
don`t worry about the error.
this error and fix is so common now.
Just New version of GCC ( 4.5 series) does not like the X::X() construct.
so simple solution is to change all X::X() construct to X() construct.
if you again meet another file with those errors during compile,
fix it in same way.

16th December 2010, 09:09 PM
Edit this file-- ./ns-allinone-2.34/ns-2.34/mobile/nakagami.cc
In line number 183 instead of--
resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();
resultPower = ErlangRandomVariable(Pr/m, int_m).value();
In line number 185 instead of--
resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();
resultPower = GammaRandomVariable(m, Pr/m).value();

And also edit the file-- ./ns-allinone-2.34/ns-2.34/tools/ranvar.cc
In line number 219 instead of--
return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);
return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_);

21st February 2011, 01:46 PM
have a problem when using Ns-2...please help me...:confused:

This problem below:

make: g++: Command not found
make: *** [tcl2c++] Error 127
tclcl-1.19 make failed! Exiting ...

21st February 2011, 02:07 PM
my question is that if you DO NOT know the basics like installing the development tools group with yum then WHY THE FRAC are you trying to install ns-2

21st February 2011, 08:39 PM
tools/ranvar.cc: In member function ‘virtual double GammaRandomVariable::value()’:
tools/ranvar.cc:219:70: error: cannot call constructor ‘GammaRandomVariable::GammaRandomVariable’ directly
tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant ‘::GammaRandomVariable’
make: *** [tools/ranvar.o] Error 1
Ns make failed!

help me?

22nd February 2011, 01:56 AM
in a few posts above IT WAS STATED ( post 8) that for the VERY VERY VERY OLD ns2 to build using the current gcc 4.5 compiler that ns2 MUST BE EDITED( hacked/ ported) TO BUILD WITH IT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!

build using gcc 3.4 or rewrite the code to build with gcc 4.5 -- see post 8 !!!!!!!!!!!!!

4th July 2011, 06:57 PM

This solution will solve the installation problem in latest Fedora 15 (gcc 4.6) also.

First make the changes as mentioned in the reply #9

Then in the file mac/mac-802_11Ext.h you need to include another file since the "offsetof" is a problem here. So jst add

Another missing problem exists in the file mobile/nakagami.cc

At the end of line #185 there isn't any semicolon. So jst add that.

And now its done!!

Enjoy :)