LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 04-12-2017, 01:34 AM   #1
rc49
Member
 
Registered: May 2015
Posts: 45

Rep: Reputation: Disabled
problem in changing gcc version


i am trying to change gcc version in my system
my system specifications are:
ubuntu 12.04 (32 bit)

i search for this on google and find that version of gcc and g++ have to changed together so i followed the link below

https://codeyarns.com/2015/02/26/how...-alternatives/

but when i run following command
Code:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6.3 100 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6.3
got following error
Code:
update-alternatives: error: alternative path /usr/bin/gcc-4.6.3 doesn't exist.
i check my gcc version using command :
Code:
gcc --version
got following output
Code:
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
any help will be appreciated.
thank you
 
Old 04-12-2017, 01:44 AM   #2
notKlaatu
Senior Member
 
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,077

Rep: Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732
I don't use Ubuntu or Debian, but what I would do is confirm that /usr/bin/gcc-4.6.3 actually exists. Bash is rarely wrong; just because gcc --version returns 4.6.3, it doesn't mean that the file is necessarily located at /usr/bin/gcc-4.6.3

Look in /usr/bin and find out what the gcc (and g++) symlinks are actually called.
 
Old 04-12-2017, 07:27 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
@rc49

If you want gcc-4.6.3 fully installed please do
sudo apt-get install g++ ( Will install gcc-4.6, g++-4.6 )

* Actually gcc-4.6 / g++-4.6 (4.6.3) is already the default system compiler for Ubuntu 12.04 !
 
Old 04-12-2017, 08:09 AM   #4
rc49
Member
 
Registered: May 2015
Posts: 45

Original Poster
Rep: Reputation: Disabled
gcc version 4.3

Quote:
Originally Posted by knudfl View Post
@rc49

If you want gcc-4.6.3 fully installed please do
sudo apt-get install g++ ( Will install gcc-4.6, g++-4.6 )

* Actually gcc-4.6 / g++-4.6 (4.6.3) is already the default system compiler for Ubuntu 12.04 !
hello knudfl
i already have fully installed gcc and g++.
actually i want to run leach patch on ns2.35. i installed it using steps posted on following link

http://www.nsnam.com/2015/05/leach-p...in-ns2-ns.html

after completing all steps, when i test patch... it gives following error
Code:
Error!!
str2addr:Address 2147483647 outside range of address field length 1073741824
i searched it on google and found that it could be fixed by switching to gcc 4.3

i also tried following command
Code:
sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.4 g++-4.4
after this when i check version of gcc using command : gcc --version
it again shows 4.6.3
any content if u have regarding this issue then it will be very helpful!!

Last edited by rc49; 04-12-2017 at 08:18 AM. Reason: information missing
 
Old 04-12-2017, 09:53 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #4.
Quote:
str2addr:Address 2147483647 outside range of address field length 1073741824
That's because you are using a 32bits OS.
Leach for ns-2.35 works with a 64bits OS only.


There is no reason to do anything to the OS in order to use a different compiler.
1) Old version (2011) of ns-allinone-2.35 :
$ export CC=gcc-4.4 CXX=g++-4.4 && ./install

2) Use the Oct2014 update, ns-allinone-2.35_gcc482.tar.gz (All gcc/g++ versions -4.4.. -5.3)
https://drive.google.com/file/d/0B7S...ew?usp=sharing
Then the build command is simply ./install


A later HOWTO for the "T S Pradeepkumar LEACH" : post #11 ...
http://www.linuxquestions.org/questi...4175556129/#11
... Much easier to do "everything editing" with a single patch = leach_ns235-Jun2015.patch

Visualization : generate file for xgraph → leach__nodes-alive.awk, post #9
http://www.linuxquestions.org/questi...-4175556129/#9


-

Last edited by knudfl; 04-12-2017 at 10:04 AM.
 
1 members found this post helpful.
Old 04-14-2017, 08:21 AM   #6
rc49
Member
 
Registered: May 2015
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
Re #4.

That's because you are using a 32bits OS.
Leach for ns-2.35 works with a 64bits OS only.


There is no reason to do anything to the OS in order to use a different compiler.
1) Old version (2011) of ns-allinone-2.35 :
$ export CC=gcc-4.4 CXX=g++-4.4 && ./install

2) Use the Oct2014 update, ns-allinone-2.35_gcc482.tar.gz (All gcc/g++ versions -4.4.. -5.3)
https://drive.google.com/file/d/0B7S...ew?usp=sharing
Then the build command is simply ./install


A later HOWTO for the "T S Pradeepkumar LEACH" : post #11 ...
http://www.linuxquestions.org/questi...4175556129/#11
... Much easier to do "everything editing" with a single patch = leach_ns235-Jun2015.patch

Visualization : generate file for xgraph → leach__nodes-alive.awk, post #9
http://www.linuxquestions.org/questi...-4175556129/#9


-
hello knudfl
i followed all the steps n installed 2014 update of ns2.35 and for leach patch i followed post #11.
after completing all the steps.. at last when i run command :
Code:
./leach_test
i receive same error in leach.err
Code:
INITIALIZE THE LIST xListHead
Error!!
str2addr:Address 2147483647 outside range of address field length 1073741824
 
Old 04-14-2017, 08:39 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re post #6 : Please do not quote entire post. A "one word reference" will do.


Your errors : So which 64bits OS are you now using ? ?
 
Old 04-14-2017, 08:45 AM   #8
rc49
Member
 
Registered: May 2015
Posts: 45

Original Poster
Rep: Reputation: Disabled
@knudfl
i m using ubuntu 12.04 32bit
i have mentioned it in earlier posts!!
 
Old 04-14-2017, 08:58 AM   #9
rc49
Member
 
Registered: May 2015
Posts: 45

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
Re post #6 :

Your errors : So which 64bits OS are you now using ? ?
i m using ubuntu 12.04 32 bit
is it possible on my system to add patch of leach????
 
Old 04-14-2017, 10:11 AM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,517

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Re #9.

Please read post #5 : »» Leach for ns-2.35 works with a 64bits OS only. ««

32bits :
The older leach version will kind of work : leach+pegasis_ns234.patch
... and output a less rich result than the ns235 version.
Code:
cd ns-allinone-2.34/
patch -p0 < ns234_gcc49.patch
https://drive.google.com/file/d/0B7S...ew?usp=sharing
zcat leach+pegasis_ns234.patch.gz | patch -p0
https://drive.google.com/file/d/0B7S...ew?usp=sharing
./install
cd ns-2.34/
sudo make install
./test

-

Last edited by knudfl; 04-14-2017 at 10:32 AM.
 
1 members found this post helpful.
Old 04-14-2017, 10:56 AM   #11
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
update-alternatives are for things that link to something in /etc/alternatives/, which gcc doesn't do.

$ ls -l /usr/bin/gcc*
$ ls -l /usr/bin/g??

At a low level you can change the /usr/bin/gcc link to the version that you want. And g++, gdb, ..., ..., ... Which update-alternatives might handle, but probably not how you're supposed to do it IMO. For some things you can set the CC and CXX type environment variables and that would work. Depending on if gcc is hard coded into the build scripts. It should NOT be, but it often IS hard coded.

For 64 bit on a 32 bit system, you should avoid that. Where 32 bit on a 64 bit system is more possible.
 
  


Reply

Tags
gcc, leach ns235, ns2, ubuntu 12.04



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
Problem during installation for GCC version 3.0 strewberry SUSE / openSUSE 6 08-21-2011 05:40 AM
GCC version problem mugdha Fedora 3 08-06-2008 08:00 AM
Gcc version problem infantpapa Linux - Software 3 12-20-2004 01:40 PM
Changing gcc version xjphil Linux - Newbie 0 05-21-2004 09:50 AM
gcc - version problem sadeer Linux - Software 1 07-19-2003 04:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:36 PM.

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