I am using Ubuntu 12.04.3 LTS, 64-bit, with gcc 4.6.3

I want to update gcc to 4.7, and do as the link said:

How do I install gcc 4.7?

But I got error:

Fetched 14.0 MB in 18s (767 kB/s)                                    
(Reading database ... 205536 files and directories currently installed.)
Preparing to replace libgcc1 1:4.6.3-1ubuntu5 (using .../libgcc1_1%3a4.8.1-2ubuntu1~12.04_amd64.deb) ...
Unpacking replacement libgcc1 ...
dpkg: error processing /var/cache/apt/archives/libgcc1_1%3a4.8.1-2ubuntu1~12.04_amd64.deb (--unpack):
 trying to overwrite '/lib/x86_64-linux-gnu/libgcc_s.so.1', which is also in package gcc-4.6 4.6.3-1ubuntu5
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

so I remove gcc 4.6:

sudo apt-get remove gcc-4.6
sudo apt-get update
apt-get: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory

Now apt-get, vi can't work any more.


This isn't a genuine fix, but a workaround.

The correct course of action is to install gcc-multilib, with apt-get install gcc-multilib

  • This helped like charme on Ubuntu 5.4.0-6ubuntu1~16.04.5! Why is it a workaround? – Dirk Schumacher Nov 23 '17 at 13:31

installing gcc-multilib is the only thing that helped for me, i am running ubuntu 15. Thank you!

  • Ubuntu 16 and this worked for me as well – smac89 May 18 '16 at 1:13

I copy a libgcc_s.so.1 from other computer to /lib/x86_64-linux-gnu/

Then the problem solved.

I install gcc-4.7 again, it succeed.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.