5

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:
 /var/cache/apt/archives/libgcc1_1%3a4.8.1-2ubuntu1~12.04_amd64.deb
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.

15

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

1
  • 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
4

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.

3

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

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

(I stumbled upon the same issue years later, and nobody except Aylwyn Lake addresses the original situation where apt-get does not work)

So, if you face this error message when running apt:

apt: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory

you can still hopefully bring back libgcc_s.so.1. Here are two solutions:

  • install a .deb package with dpkg instead of apt. You should find such a package on pkgs.org - be sure to select the right version. Then run sudo dpkg -i packagename.deb
  • find this file somewhere else on your harddrive and place a copy in the folder /lib/x86_64-linux-gnu.
    You can search all across your disk with the command find / -name "libgcc_s.so.1".
    You may also find this file on a live or installation device (CD, USB stick) if you have one
0

I follow iaeiou 's suggesstion and solve this problem successfully for my Jetson-tx2 (arm64 system) with the help of my another PC.

First, I download the libgcc1-dbg_6.3.0-18+deb9u1_arm64.deb from this website

http://http.us.debian.org/debian/pool/main/g/gcc-6/

Then I use scp to sent this deb package to my Jetson-tx2

/home/my_usrname $  scp /home/my_usrname/libgcc1_6.3.0-18+deb9u1_arm64.deb tx2-usrname@192.168.1.195:/home/usrname

Finally I switch to Jetson-tx2 and install this deb package

/home/tx2-usrname $  sudo dpkg -i libgcc1_6.3.0-18+deb9u1_arm64.deb

ps: maybe you also need to download the gcc-6-base as the dependence of the libgcc1-xxxx.deb, which is in https://packages.debian.org/stretch/gcc-6-base or http://http.us.debian.org/debian/pool/main/g/gcc-6/ and use the same method.

Sorry for my poor English.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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