PDA

View Full Version : [ubuntu] g++ 4.2 to g++ 4.0



scuba123
August 11th, 2008, 04:20 AM
Hi Everyone,

I am having a problem with g++ installation. I removed g++ version 4.2.3 and I installed g++ 4.0.1 due to some reason. I got some complications as seen in the following:

If I ran "g++ --version" as seen below:
------------------------------
rack2@ubuntu:~/test2$ g++ --version
g++ (GCC) 4.0.1
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
----------------------------------

It shows the version is 4.0.1. However if I ran the following command:
-----------------------
rack2@ubuntu:~/test2$ ls -la /usr/bin/gcc
lrwxrwxrwx 1 root root 7 2008-07-17 22:34 /usr/bin/gcc -> gcc-4.2
-------------------------------
rack2@ubuntu:~/test2$ dpkg -l|grep gcc
ii gcc 4:4.2.3-1ubuntu6 The GNU C compiler
ii gcc-4.2 4.2.3-2ubuntu7 The GNU C compiler
ii gcc-4.2-base 4.2.3-2ubuntu7 The GNU Compiler Collection (base package)
ii libgcc1 1:4.2.3-2ubuntu7 GCC support library
----------------------------------------
rrack2@ubuntu:~/test2$ dpkg -l|grep c++
ii libsigc++-2.0-0c2a 2.0.17-2ubuntu3 type-safe Signal Framework for C++ - runtime
ii libstdc++6 4.2.3-2ubuntu7 The GNU Standard C++ Library v3
--------------------------------------

Is there a way to fix this? If I have to re-install gcc and g++, could you explain its installation steps? Please help. Thanks in advance.

Regards,

scuba123

eightmillion
August 11th, 2008, 04:31 AM
Try sudo apt-get install --reinstall gcc-4.2
and then do g++ --version and see if your problem is resolved.

Edit: You'll probably have to change that to sudo apt-get install --reinstall g++-4.2

scuba123
August 11th, 2008, 04:38 AM
Hi Eightmillion,

apt-get is not working right now. I would like to install g++ 4.0.1.

rack2@ubuntu:~$ sudo apt-get install --reinstall gcc-4.2
[sudo] password for rack2:
apt-get: /usr/local/lib/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/local/lib/libstdc++.so.6)

Please help. Thanks.

Regards,

scuba123

eightmillion
August 11th, 2008, 04:50 AM
How did you install g++ 4.0.1?

Could you post the output of ls -la /usr/local/lib/

scuba123
August 11th, 2008, 05:02 AM
Hi Eightmillion,

Thanks for your reply. I downloaded gcc/g++ version 4.0.1 from this link ftp://ftp.gnu.org/pub/gnu/gcc/. I then ran "configure" and "sudo make install". Please help. Thanks.

rack2@ubuntu:~$ ls -la /usr/local/lib
total 208692
drwxr-xr-x 7 root root 4096 2008-08-10 20:09 .
drwxr-xr-x 12 root root 4096 2008-07-24 16:44 ..
drwxr-xr-x 3 root root 4096 2008-07-24 16:44 gcc
drwxr-xr-x 2 root root 4096 2008-07-24 16:44 gcj-4.0.1
-rw-r--r-- 1 root root 38658 2008-07-24 16:44 libffi.a
-rwxr-xr-x 1 root root 728 2008-07-24 16:44 libffi.la
lrwxrwxrwx 1 root root 15 2008-07-24 16:44 libffi.so -> libffi.so.4.0.1
lrwxrwxrwx 1 root root 15 2008-07-24 16:44 libffi.so.4 -> libffi.so.4.0.1
-rwxr-xr-x 1 root root 28350 2008-07-24 16:44 libffi.so.4.0.1
lrwxrwxrwx 1 root root 13 2008-07-24 16:44 libgcc_s.so -> libgcc_s.so.1
-rw-r--r-- 1 root root 226179 2008-07-24 16:44 libgcc_s.so.1
-rw-r--r-- 1 root root 133848050 2008-07-24 16:45 libgcj.a
-rwxr-xr-x 1 root root 1030 2008-07-24 16:44 libgcj.la
lrwxrwxrwx 1 root root 15 2008-07-24 16:44 libgcj.so -> libgcj.so.6.0.0
lrwxrwxrwx 1 root root 15 2008-07-24 16:44 libgcj.so.6 -> libgcj.so.6.0.0
-rwxr-xr-x 1 root root 65058617 2008-07-24 16:44 libgcj.so.6.0.0
-rw-r--r-- 1 root root 358 2008-07-24 16:45 libgcj.spec
-rw-r--r-- 1 root root 15490 2008-07-24 16:45 libgij.a
-rwxr-xr-x 1 root root 1143 2008-07-24 16:45 libgij.la
lrwxrwxrwx 1 root root 15 2008-07-24 16:45 libgij.so -> libgij.so.6.0.0
lrwxrwxrwx 1 root root 15 2008-07-24 16:45 libgij.so.6 -> libgij.so.6.0.0
-rwxr-xr-x 1 root root 17389 2008-07-24 16:45 libgij.so.6.0.0
-rw-r--r-- 1 root root 530920 2008-07-24 16:44 libiberty.a
-rw-r--r-- 1 root root 367458 2008-07-24 16:44 libmudflap.a
-rwxr-xr-x 1 root root 761 2008-07-24 16:44 libmudflap.la
lrwxrwxrwx 1 root root 19 2008-07-24 16:44 libmudflap.so -> libmudflap.so.0.0.0
lrwxrwxrwx 1 root root 19 2008-07-24 16:44 libmudflap.so.0 -> libmudflap.so.0.0.0
-rwxr-xr-x 1 root root 229136 2008-07-24 16:44 libmudflap.so.0.0.0
-rw-r--r-- 1 root root 398982 2008-07-24 16:44 libmudflapth.a
-rwxr-xr-x 1 root root 775 2008-07-24 16:44 libmudflapth.la
lrwxrwxrwx 1 root root 21 2008-07-24 16:44 libmudflapth.so -> libmudflapth.so.0.0.0
lrwxrwxrwx 1 root root 21 2008-07-24 16:44 libmudflapth.so.0 -> libmudflapth.so.0.0.0
-rwxr-xr-x 1 root root 249669 2008-07-24 16:44 libmudflapth.so.0.0.0
-rw-r--r-- 1 root root 399752 2008-07-24 16:44 libobjc.a
-rwxr-xr-x 1 root root 735 2008-07-24 16:44 libobjc.la
lrwxrwxrwx 1 root root 16 2008-07-24 16:44 libobjc.so -> libobjc.so.1.0.0
lrwxrwxrwx 1 root root 16 2008-07-24 16:44 libobjc.so.1 -> libobjc.so.1.0.0
-rwxr-xr-x 1 root root 290396 2008-07-24 16:44 libobjc.so.1.0.0
-rw-r--r-- 1 root root 6438936 2008-07-24 16:44 libstdc++.a
-rwxr-xr-x 1 root root 1010 2008-07-24 16:44 libstdc++.la
lrwxrwxrwx 1 root root 18 2008-07-24 16:44 libstdc++.so -> libstdc++.so.6.0.5
lrwxrwxrwx 1 root root 18 2008-08-10 20:09 libstdc++.so.6 -> libstdc++.so.6.0.9
-rwxr-xr-x 1 root root 3836051 2008-07-24 16:44 libstdc++.so.6.0.5
-rw-r--r-- 1 root root 970680 2008-08-10 20:10 libstdc++.so.6.0.9
-rw-r--r-- 1 root root 393950 2008-07-24 16:44 libsupc++.a
-rwxr-xr-x 1 root root 918 2008-07-24 16:44 libsupc++.la
-rw-r--r-- 1 root root 324 2008-07-24 16:47 logging.properties
drwxr-xr-x 2 root root 4096 2008-07-24 16:47 pkgconfig
drwxrwsr-x 3 root staff 4096 2008-07-15 09:03 python2.5
drwxr-xr-x 2 root root 4096 2008-07-24 16:47 security

eightmillion
August 11th, 2008, 05:17 AM
You have gcc 4.0.1 installed. you just need to call it with the full path: /usr/local/lib/gcc

You can change your path so that the copy installed in /usr/local/lib is called first.

scuba123
August 11th, 2008, 05:37 AM
Hi Eightmillion,

Thank you for your help. As for this error, is there a way to fix it? Thanks.

rack2@ubuntu:~$ sudo apt-get update
[sudo] password for rack2:
apt-get: /usr/local/lib/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/local/lib/libstdc++.so.6)

eightmillion
August 11th, 2008, 05:51 AM
Try this:


sudo ln -s /lib/libgcc_s.so.1 /usr/local/lib/

then try your update again.

scuba123
August 11th, 2008, 06:39 AM
Hi Eightmillion,

Thanks for your reply. The following is the output of the command.

rack2@ubuntu:~$ sudo ln -s /lib/libgcc_s.so.1 /usr/local/lib/
ln: creating symbolic link `/usr/local/lib/libgcc_s.so.1': File exists
rack2@ubuntu:~$ sudo apt-get update
apt-get: /usr/local/lib/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/local/lib/libstdc++.so.6)
rack2@ubuntu:~$

Please help. Thanks in advance.

Regards,

scuba123

eightmillion
August 11th, 2008, 06:41 AM
Do this first:


sudo mv /usr/local/lib/libgcc_s.so.1 /root/

Then


sudo ln -s /lib/libgcc_s.so.1 /usr/local/lib/

Then try the update.

scuba123
August 11th, 2008, 07:15 AM
Hi Eightmillion,

It's fixed now. That's awesome. Thank you very much. Would you like to explain a little bit on "sudo mv /usr/local/lib/libgcc_s.so.1 /root/ " (your first instruction)? Can I remove libgcc_s.so.1, which is already in /root/? Thank you.

Regards,

Scuba123

eightmillion
August 11th, 2008, 07:20 AM
Would you like to explain a little bit on "sudo mv /usr/local/lib/libgcc_s.so.1 /root/ " (your first instruction)? Can I remove libgcc_s.so.1, which is already in /root/? Thank you.
I'm glad that worked. The point of that command was to move libgcc_s.so.1 out of the way so we could link the version required by apt there, but still keep it handy in case it was needed later. You can remove it now without any problems. sudo rm /root/libgcc_s.so.1