LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   how to install gcc4.1 on ubuntu12.04 (https://www.linuxquestions.org/questions/linux-networking-3/how-to-install-gcc4-1-on-ubuntu12-04-a-4175475000/)

lzw1012 08-28-2013 05:25 AM

how to install gcc4.1 on ubuntu12.04
 
hello everbody:
I use ubuntu12.04,now I will use ns2.31 on ubuntu12.04,but when i install ns2.31 ,there have lots of errors.
i search some same questions,the ns2.31 need gcc4.1 ,but ubuntu12.04 only gcc4.4.
how can i install gcc4.1 on ubuntu12.04.

thank you very much!!!

knudfl 08-28-2013 05:37 AM

Welcome to LQ.

gcc / g++ version 4.1.2 : Links, post #47 here ..
http://www.linuxquestions.org/questi...532/page4.html
sudo dpkg -i gcc41-compat-4.1.2-ubuntu1210_i386.deb g++41-compat-4.1.2_i386.deb
... Then reboot, and the new compiler can be used.

Using : cd ns-allinone-2.31/ && export CC=gcc41 CXX=g++41 && ./install

-

lzw1012 09-06-2013 08:02 AM

I do it step by step according to knudfl'post ,but I don't success . has it another way ??thank you all. especial knudfl'post ,thank you!

knudfl 09-06-2013 09:03 AM

# 3 .
Quote:

I do it step by step ...... but I don't success
May be you have a 64bits OS ? ?
Please try this command : $ uname -m <Enter>

The "i386" packages are usable on a 32bits (i686) OS only.

And :
ns2 is for a 32bits OS. Not everything may work, if it's 64bits.

-

lzw1012 10-02-2013 07:00 PM

Quote:

Originally Posted by knudfl (Post 5023065)
# 3 .

May be you have a 64bits OS ? ?
Please try this command : $ uname -m <Enter>

The "i386" packages are usable on a 32bits (i686) OS only.

And :
ns2 is for a 32bits OS. Not everything may work, if it's 64bits.

-


Thank you very much ! I now change to ubuntu10.10,but I get some message :


(Reading database ... 119129 files and directories currently installed.)
Preparing to replace cpp-4.1 4.1.2-27ubuntu1 (using cpp-4.1_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement cpp-4.1 ...
Preparing to replace g++-4.1 4.1.2-27ubuntu1 (using g++-4.1_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement g++-4.1 ...
Preparing to replace g++-4.1-multilib 4.1.2-27ubuntu1 (using g++-4.1-multilib_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement g++-4.1-multilib ...
Preparing to replace gcc-4.1 4.1.2-27ubuntu1 (using gcc-4.1_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement gcc-4.1 ...
Preparing to replace gcc-4.1-base 4.1.2-27ubuntu1 (using gcc-4.1-base_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement gcc-4.1-base ...
Preparing to replace gcc-4.1-multilib 4.1.2-27ubuntu1 (using gcc-4.1-multilib_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement gcc-4.1-multilib ...
Preparing to replace lib64stdc++6-4.1-dbg 4.1.2-27ubuntu1 (using lib64stdc++6-4.1-dbg_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement lib64stdc++6-4.1-dbg ...
Preparing to replace libstdc++6-4.1-dbg 4.1.2-27ubuntu1 (using libstdc++6-4.1-dbg_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement libstdc++6-4.1-dbg ...
Preparing to replace libstdc++6-4.1-dev 4.1.2-27ubuntu1 (using libstdc++6-4.1-dev_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement libstdc++6-4.1-dev ...
Preparing to replace libstdc++6-4.1-pic 4.1.2-27ubuntu1 (using libstdc++6-4.1-pic_4.1.2-27ubuntu1_i386.deb) ...
Unpacking replacement libstdc++6-4.1-pic ...
dpkg: dependency problems prevent configuration of g++-4.1-multilib:
g++-4.1-multilib depends on lib64stdc++6 (>= 4.1.2-27ubuntu1); however:
Package lib64stdc++6 is not installed.
dpkg: error processing g++-4.1-multilib (--install):
dependency problems - leaving unconfigured
Setting up gcc-4.1-base (4.1.2-27ubuntu1) ...
dpkg: dependency problems prevent configuration of gcc-4.1-multilib:
gcc-4.1-multilib depends on libc6-dev-amd64; however:
Package libc6-dev-amd64 is not installed.
gcc-4.1-multilib depends on lib64gcc1 (>= 1:4.1.2-27ubuntu1); however:
Package lib64gcc1 is not installed.
dpkg: error processing gcc-4.1-multilib (--install):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of lib64stdc++6-4.1-dbg:
lib64stdc++6-4.1-dbg depends on lib64stdc++6 (>= 4.1.2-27ubuntu1); however:
Package lib64stdc++6 is not installed.
dpkg: error processing lib64stdc++6-4.1-dbg (--install):
dependency problems - leaving unconfigured
Setting up libstdc++6-4.1-dbg (4.1.2-27ubuntu1) ...
Setting up cpp-4.1 (4.1.2-27ubuntu1) ...
Processing triggers for man-db ...
Setting up gcc-4.1 (4.1.2-27ubuntu1) ...
Setting up libstdc++6-4.1-dev (4.1.2-27ubuntu1) ...
Setting up libstdc++6-4.1-pic (4.1.2-27ubuntu1) ...
Setting up g++-4.1 (4.1.2-27ubuntu1) ...
Errors were encountered while processing:
g++-4.1-multilib
gcc-4.1-multilib
lib64stdc++6-4.1-dbg

how can i do ?

thanks!

knudfl 10-02-2013 07:40 PM

# 5 .
Quote:

I now change to ubuntu10.10, but I get some message :
.
.
? ? Which command(s) are you doing to get all that text ? ?

Still looks like a 64bits OS ?

And why not use a 32bits Ubuntu 12.04 ?
( Ubuntu 10.10 32bits is good with ns-2.26...2.29,
but `10.10' is unsupported.)

-

lzw1012 10-02-2013 09:51 PM

Quote:

Originally Posted by knudfl (Post 5038920)
# 5 .

? ? Which command(s) are you doing to get all that text ? ?

Still looks like a 64bits OS ?

And why not use a 32bits Ubuntu 12.04 ?
( Ubuntu 10.10 32bits is good with ns-2.26...2.29,
but `10.10' is unsupported.)

-

thanks a lot!
I use command:

sudo dpkg -i *.deb

my os is not 64bit,I will try 32bits Ubuntu 12.04.

when compiling ns2.31 with gcc-4.4 and g++-4.4 ,there have lots of warnings such as:

/common/packet.h:210: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:211: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:212: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:213: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:214: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:215: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:216: warning: deprecated conversion from string constant to ‘char*’

how can I do ??thanks !!

lzw1012 10-02-2013 10:12 PM

Quote:

Originally Posted by lzw1012 (Post 5038972)
thanks a lot!
I use command:

sudo dpkg -i *.deb

my os is not 64bit,I will try 32bits Ubuntu 12.04.

when compiling ns2.31 with gcc-4.4 and g++-4.4 ,there have lots of warnings such as:

/common/packet.h:210: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:211: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:212: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:213: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:214: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:215: warning: deprecated conversion from string constant to ‘char*’
./common/packet.h:216: warning: deprecated conversion from string constant to ‘char*’

how can I do ??thanks !!

anyway,which IDE is better chioce when developing ns2.31 with ubuntu 12.04???
thanks !

knudfl 10-02-2013 10:31 PM

# 8 .

Please do not quote your own posts. Delete, please.

IDE : No reason to make things complicated.


Quote:

when compiling ns2.31 with gcc-4.4 and g++-4.4
Also a way of complicating a simple build.
This will do :
tar xvf ns-allinone-2.31 && cd ns-allinone-2.31/
export CC=gcc41 CXX=g++41 && ./install


Warnings are "informative text", not errors.

-

lzw1012 10-02-2013 10:42 PM

I have not success to install gcc-4.1 and g++-4.1 on Ubuntu 12.04.
I try as your tips.

knudfl 10-03-2013 08:51 AM

# 10 .

Sorry, should be : $ sudo dpkg -i gcc41-compat-4.1.2.ubu1204_i386.deb
for the "gcc41-compat" :
https://docs.google.com/file/d/0B7S2...it?usp=sharing

The "g++-compat" : g++41-compat-4.1.2_i386.deb
https://docs.google.com/file/d/0B7S2...it?usp=sharing

-

lzw1012 10-04-2013 03:14 AM

I download an install step by step ,but I don't find gcc-4.1

/usr/bin
ls -al |grep gcc*
I get :only gcc-4.6

how I do ???

thank you!

knudfl 10-04-2013 05:14 AM

# 12 .

How to check an executable : $ which gcc41
... The answer better be : /usr/gcc41/bin/gcc41

A script that sets the PATH is included :
/etc/profile.d/gcc41.sh
... which you will know from the file list :
$ dpkg -L gcc41-compat

-

lzw1012 10-04-2013 06:30 AM

it's ok !I find it !thank you very much!

I do some steps as :

rm /usr/bin /gcc
ln -s /usr/gcc41/bin/gcc41 /usr/bin/gcc

now I can use gcc-4.1? is it right?

thank you!

knudfl 10-04-2013 07:39 AM

# 14 .

No. You cannot use "gcc-4.1" : There is no file with that name.


Quote:

rm /usr/bin /gcc
ln -s /usr/gcc41/bin/gcc41 /usr/bin/gcc
No reason at all to do that.
All versions of gcc can be used with :
$ export CC=gcc<?> CXX=g++<?> && <other-command>
... Please read post #2 :
$ cd ns-allinone-2.31/ && export CC=gcc41 CXX=g++41 && ./install


What you can do with symlinks is :
$ cd /usr/bin/
$ sudo ln -s ../gcc41/bin/gcc41
$ sudo ln -s ../gcc41/bin/g++41

-


All times are GMT -5. The time now is 02:37 AM.