Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4K views

NS-2.34 Installation in Ubuntu 12.04: ns2 ns2 CD Ns2/ns-Allinone-2.34

This document provides solutions to errors that may occur when installing NS-2.34 in Ubuntu 12.04. The errors involve undefined references in linking otcl, errors constructing random variable objects, missing header files, and path setup issues. The solutions involve modifying lines in configuration files and source code files to switch the linker, remove constructor calls, include needed headers, and correctly set library paths.

Uploaded by

anurag6866
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4K views

NS-2.34 Installation in Ubuntu 12.04: ns2 ns2 CD Ns2/ns-Allinone-2.34

This document provides solutions to errors that may occur when installing NS-2.34 in Ubuntu 12.04. The errors involve undefined references in linking otcl, errors constructing random variable objects, missing header files, and path setup issues. The solutions involve modifying lines in configuration files and source code files to switch the linker, remove constructor calls, include needed headers, and correctly set library paths.

Uploaded by

anurag6866
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 4

For Ubuntu 9.

10 (karmic), you may encounter this error in the linking of otcl:


otcl.o: In function `OTclDispatch': /home/ns/ns-allinone-2.34/otcl/otcl.c:495: undefined reference to `__stack_chk_fail_local' otcl.o: In function `Otcl_Init': /home/ns/ns-allinone-2.34/otcl/otcl.c:2284: undefined reference to `__stack_chk_fail_local' ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined ld: final link failed: Nonrepresentable section on output make: *** [libotcl.so] Error 1

This error is because the linker being used is "ld -shared" instead of "gcc -shared". If you edit one line in otcl-1.13/configure, and rerun install, it should work:
--- configure.orig 2009-11-02 12:14:52.556167945 -0800 +++ configure 2009-11-02 12:17:28.966706099 -0800 @@ -6301,7 +6301,7 @@ ;; Linux*) SHLIB_CFLAGS="-fpic" SHLIB_LD="ld -shared" + SHLIB_LD="gcc -shared" SHLIB_SUFFIX=".so" DL_LIBS="-ldl" SHLD_FLAGS=""

This will be fixed in future revisions of ns-2. f (int_m == m) { + resultPower = ErlangRandomVariable(Pr/m, int_m).value(); + } else { + resultPower = GammaRandomVariable(m, Pr/m).value(); + } + return resultPower; + }

NS-2.34 installation in Ubuntu 12.04


Follow the below given steps: Download ns-allinnone-2.34 from nasam website http://sourceforge.net/projects/nsnam/files/ns-2
Create a folder in home with name ns2

Extract the tar file in ns2

Open terminal and type cd ns2/ns-allinone-2.34

Install required libraries for ns2 using terminal sudo apt-get install build-essential autoconf automake libxmu-dev

Then, sudo ./install

For errors, 1. ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined ld: final link failed: Bad value make: *** [libotcl.so] Error 1 otcl-1.13 make failed! Exiting ... Solution: In otcl-1.13/configure, line number 6304 -SHLIB_LD="ld -shared" +SHLIB_LD="gcc -shared" 2. tools/ranvar.cc: In member function virtual double GammaRandomVariable::value(): tools/ranvar.cc:219:70: error: cannot call constructor GammaRandomVariable::GammaRandomVariable directly [-fpermissive] tools/ranvar.cc:219:70: error: for a function-style cast, remove the redundant ::GammaRandomVariable [-fpermissive] make: *** [tools/ranvar.o] Error 1 Solution: In ns-2.34/tools/ranvar.cc, line 219 -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_); 3. In file included from mac/mac-802_11Ext.cc:66:0: mac/mac-802_11Ext.h: In member function u_int32_t PHY_MIBExt::getHdrLen11(): mac/mac-802_11Ext.h:175:19: error: expected primary-expression before struct mac/mac-802_11Ext.h:175:41: error: dh_body was not declared in this scope mac/mac-802_11Ext.h:175:51: error: offsetof was not declared in this scope mac/mac-802_11Ext.h:177:3: warning: control reaches end of non-void function [-Wreturn-type] make: *** [mac/mac-802_11Ext.o] Error 1 Ns make failed! Solution: In mac/mac-802_Ext.h, line 65 +#include<cstddef> 4. mobile/nakagami.cc: In member function virtual double Nakagami::Pr(PacketStamp*, PacketStamp*, WirelessPhy*):

mobile/nakagami.cc:183:73: error: cannot call constructor ErlangRandomVariable::ErlangRandomVariable directly [-fpermissive] mobile/nakagami.cc:183:73: error: for a function-style cast, remove the redundant ::ErlangRandomVariable [-fpermissive] mobile/nakagami.cc:185:67: error: cannot call constructor GammaRandomVariable::GammaRandomVariable directly [-fpermissive] mobile/nakagami.cc:185:67: error: for a function-style cast, remove the redundant ::GammaRandomVariable [-fpermissive] make: *** [mobile/nakagami.o] Error 1 Solution: In ns-2.34/mobile/nakagami.cc, Line no. -if (int_m == m) { resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value(); } else { resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value(); } return resultPower; - } +if (int_m == m) { + resultPower = ErlangRandomVariable(Pr/m, int_m).value(); + } else { + resultPower = GammaRandomVariable(m, Pr/m).value(); + } + return resultPower; + } Path Setup:
In terminal sudo gedit ~/.bash_aliases

Then copy the following path and modify according to your system path
# LD_LIBRARY_PATH OTCL_LIB=/home/ramakrishna/ns2/ns-allinone-2.34/otcl-1.13 NS2_LIB=/home/ramakrishna/ns2/ns-allinone-2.34/lib X11_LIB=/usr/X11R6/lib USR_LOCAL_LIB=/usr/local/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB # TCL_LIBRARY TCL_LIB=/home/ramakrishna/ns2/ns-allinone-2.34/tcl8.4.18/library USR_LIB=/usr/lib export TCL_LIBRARY=$TCL_LIB:$USR_LIB # PATH XGRAPH=/home/ramakrishna/ns2/ns-allinone-2.34/bin:/home/ramakrishna/ns2/ns-allinone2.34/tcl8.4.18/unix:/home/ramakrishna/ns2/ns-allinone-2.34/tk8.4.18/unix NS=/home/ramakrishna/ns2/ns-allinone-2.34/ns-2.34/ NAM=/home/ramakrishna/ns2/ns-allinone-2.34/nam-1.14/ PATH=$PATH:$XGRAPH:$NS:$NAM

Save the file and type source ~/.bash_aliases

Now if you type ns in terminal it will show % symbol

You might also like