Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-16-2015, 12:47 AM   #1
Registered: Jan 2014
Location: India
Distribution: Linux-(Ubuntu 12.04,14.04.02). 32-bit for Research
Posts: 84

Rep: Reputation: Disabled
Patched KeLiu's GPSR to ns-2.34 in Ubuntu 14.04.02 LTS

Installing ns-allinone-2.34 with KeLiu GPSR in Ubuntu 14.04.02 LTS

1. Install gcc-4.4 g++-4.4 compilers

*NS-2 have some compatibility problem with gcc-4.6 version, in 12.04.
*It can be also installed from the Synaptic Package Manager

$ sudo apt-get install gcc-4.4 g++-4.4

2. Update Ubuntu library

$ sudo apt-get install libxt-dev libx11-dev libxmu-dev xorg-dev xgraph

3. Put the files "ns-allinone-2.34.tar.gz", "gpsr-keliu-ns-2.34-ubuntu10_i386.deb",& "gpsr-KeLiu-patched-ns2.34.tar.gz" to (preferably) /home.

$ cd <folder_name>

4. Extract the ns-allinone-2.34.tar.gz file

$ tar zxvf ns-allinone-2.34.tar.gz

5. Copy and paste the gpsr-KeLiu-patched-ns2.34.tar.gz file to /ns-allinone-2.34
gpsr-keliu-ns-2.34-ubuntu10_i386.deb file to ns-allinone-2.34/ns-2.34

$ cp gpsr-KeLiu-patched-ns2.34.tar.gz ns-allinone-2.34

6. Unpack it to replace default "ns-2.34" with KeLiu's "ns-2.34"

$ tar zxvf gpsr-KeLiu-patched-ns2.34.tar.gz

7. Now! place gpsr-keliu-ns-2.34-ubuntu10_i386.deb file to the replaced ns-2.34 directory

$ cp gpsr-keliu-ns-2.34-ubuntu10_i386.deb ns-allinone-2.34/ns-2.34

8. move to ns-allinone-2.34 and Install

$ cd ns-allinone-2.34 && ./install

Errors under "Build OTcl-1.13"
gcc -c -g -O2 -DNDEBUG -DUSE_SHM -I............
ld: final link failed: Bad value
make: *** [] Error 1
otcl-1.13 make failed! Exiting ...

9. For successful "make" necessary changes in files of ns-2.34:



i) edit the line 6304 in otcl-1.13/configure as follows:

$ gedit /home/ns/ns-allinone-2.34/otcl-1.13/configure

#SHLIB_LD=ld -shared /*disabled this line*/
SHLIB_LD=gcc -shared /*<== added this line*/

ii) $ gedit /home/ns/ns-allinone-2.34/ns-2.34/tools/

double GammaRandomVariable::value()
// Proposed by Marsaglia in 2000:
// G. Marsaglia, W. W. Tsang: A simple method for gereating Gamma variables
// ACM Transactions on mathematical software, Vol. 26, No. 3, Sept. 2000
if (alpha_ < 1) {
double u = rng_->uniform(1.0);
//return GammaRandomVariable::GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_); /* Disabled*/
return GammaRandomVariable(1.0 + alpha_, beta_).value() * pow (u, 1.0 / alpha_); /*added this line*/

iii) $ gedit /home/ns/ns-allinone-2.34/ns-2.34/mobile/ disable line 183 and 185 add as below

if (int_m == m) {
//resultPower = ErlangRandomVariable::ErlangRandomVariable(Pr/m, int_m).value();/*disabled*/
resultPower = ErlangRandomVariable(Pr/m, int_m).value();/*added this line*/
} else {
//resultPower = GammaRandomVariable::GammaRandomVariable(m, Pr/m).value();/*disabled*/
resultPower = GammaRandomVariable(m, Pr/m).value();/*added this line*/

iv) To used gcc-4.4 and g++-4.4 as compiler to compile ns-allinone-2.34, Edit line 270 in tcl8.4.18/unix/

$ gedit /home/ns/ns-allinone-2.34/tcl8.4.18/

#CC = @CC@ //disabled
CC = @CC@-4.4 //added

v) To used gcc-4.4 and g++-4.4 as compiler to compile ns-allinone-2.34, change the line 36-37 in ns-2.34/

$ gedit /home/ns/ns-allinone-2.34/ns-2.34/

#CC = @CC@ //disabled
#CPP = @CXX@ //disabled
CC = @CC@-4.4
CPP = @CXX@-4.4

v) Also need to change the line 36-37 in ns-2.34/Makefile
N.B: the Makefile is a only available if once an ./install command is issued previously. If not skip this step.

$ gedit /home/ns/ns-allinone-2.34/ns-2.34/Makefile

#CC = gcc //disabled
#CPP = g++ //disabled
CC = gcc-4.4
CPP = g++-4.4

**********Changes complete*********

9. in ns/ns-allinone-2.34

$ sudo ./install
N.B: if the directories and files appear to be locked then run from home

sudo chmod 777 -R ns-allinone-2.34

10. Move to ns/ns-allinone-2.34/ns-2.34 and install KeLiu GPSR Software and validate

$ cd ns-2.34 && sudo dpkg -i gpsr-keliu-ns-2.34-ubuntu10_i386.deb && ./validate

11. See for GPSR directory in ns-2.34/ the object files should have been created and move to it.

$ ls
$ cd ns-2.34

12. run ns wireless.gpsr.tcl
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
GPSR configuration file
Loading connection pattern...
Loading scenario file...
Load complete...
Starting Simulation... - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 129.2

Last edited by Chakraborty; 05-20-2015 at 10:25 PM.
Old 05-16-2015, 10:33 AM   #2
LQ 5k Club
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
? Are you just trying to do things as complicated as possible ? Or ? ?
And : You are not supposed to do "$ sudo ./install".
No ns2 commands as root, or with sudo, please.
(Except 'make install' and 'cp ns-gpsr-keliu /usr/local/bin/'.)

The ns2 build prerequisites are :
$ sudo apt-get install g++ (g++-4.4) automake libtool make patch libxmu-dev

The old instructions are here, post #8 ...

Latest is :
$ cd ns-allinone-2.34/
$ patch -p0 < gpsr-KeLiu_ns234.patch
$ patch -p0 < ns234_gcc49.patch
$ ./install
$ cd ns-2.34/
$ cp ns ns-gpsr-keliu
$ sudo cp ns-gpsr-keliu /usr/local/bin/
$ cd gpsr/
$ ns-gpsr-keliu wireless-gpsr.tcl

Links :


Last edited by knudfl; 05-16-2015 at 10:41 AM.
Old 05-20-2015, 11:07 PM   #3
Registered: Jan 2014
Location: India
Distribution: Linux-(Ubuntu 12.04,14.04.02). 32-bit for Research
Posts: 84

Original Poster
Rep: Reputation: Disabled
@ #2

Dear Knud,

Upgraded the system to 14.04.

Not searched for the recent softwares

After a "fail build", tried gcc-4.4 with the previous Keliu patch, that I had, found-- it works well.

That I posted, for reference, as I searched that[KeLiu_GPSR+2.34 in 14.04] too.

And : You are not supposed to do "$ sudo ./install".
perhaps yo mean to say "sudo" accesses the kernel space and installs ns there, whereas it should be installed in the "user" space, in context of protection. Is it so...?

Made the correction.

Your valuable suggestions made this post more better and clearer for anyone who refers.

With thanks & regards.


gpsr, gpsr-keliu, ns2

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
GPSR-KeLiu elaheyazdanimiar Linux - Software 11 09-04-2014 06:42 AM
[SOLVED] NS2: tried gpsr-keliu-patched ns but error during installation sants Linux - Software 2 07-25-2013 08:11 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:57 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration