[solved] cc1: error while loading shared libraries: libmpc.so.3

I’m trying to compile some code on my RaspberryPi 2 system, which is freshly installed with OSMC (OSMC_TGT_rbp2_20181101.img).

I’ve installed build-essential (apt-get install build-essential), which is all that is usually required on a debian system to get a working compiler.

The error that I’m getting is:
/usr/lib/gcc/arm-linux-gnueabihf/6/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory

Aptitude shows that libmpc3 is installed:
# aptitude search libmpc
i libmpc-dev - multiple precision complex floating-point library development package
i A libmpc3 - multiple precision complex floating-point library

I can also find the libmp3.so.3 file, which looks to be the correct location:

find /usr/lib -iname libmpc.so.3

/usr/lib/arm-linux-gnueabihf/libmpc.so.3

Just executing cc1 without any arguments results in the same error:
# /usr/lib/gcc/arm-linux-gnueabihf/6/cc1
/usr/lib/gcc/arm-linux-gnueabihf/6/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory

uname output:
# uname -a
Linux lounge 4.14.78-2-osmc #1 SMP PREEMPT Sun Oct 28 14:59:13 UTC 2018 armv7l GNU/Linux

I’ve googled for hours and tried various symlinks and ldconfig commands. I’ve updated apt cache and upgraded all packages. I’ve removed and reinstalled a lot of the gcc-related packages and nothing seems to make a difference.

I’m at the point now that I’m going to have to manually try compiling the affected packages, but would really like to avoid doing so. Any advice would be appreciated.

Hi,

Have you tried:

sudo ldconfig

Thanks Tom.

Yes, tried again now to be sure. Still not working.

So it seems that something is a bit borked on your box, since I don’t see such an error when running the same command.

Just out of interest, what’s the output from running

ldconfig -p | grep libmpc

And since libmpc.so.3 is actually a symbolic link to libmpc.so.3.0.0, you haven’t indicated whether the underlying file exists on your system.

osmc@osmc:~$ find /usr/lib -name libmpc\* -ls
 42998739     60 -rw-r--r--   1 root     root        59488 Feb 25  2015 /usr/lib/arm-linux-gnueabihf/libmpc.so.3.0.0
 42998740      0 lrwxrwxrwx   1 root     root           15 Feb 25  2015 /usr/lib/arm-linux-gnueabihf/libmpc.so.3 -> libmpc.so.3.0.0

root@lounge:/usr/lib# ldconfig -p | grep libmpc
libmpc.so.3 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libmpc.so.3
libmpc.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libmpc.so

root@lounge:/usr/lib# find /usr/lib -iname libmpc* -ls
414928 60 -rw-r–r-- 1 root root 59488 Feb 25 2015 /usr/lib/arm-linux-gnueabihf/libmpc.so.3.0.0
416579 144 -rw-r–r-- 1 root root 143884 Feb 25 2015 /usr/lib/arm-linux-gnueabihf/libmpc.a
414933 0 lrwxrwxrwx 1 root root 15 Feb 25 2015 /usr/lib/arm-linux-gnueabihf/libmpc.so.3 -> libmpc.so.3.0.0
416580 0 lrwxrwxrwx 1 root root 15 Feb 25 2015 /usr/lib/arm-linux-gnueabihf/libmpc.so -> libmpc.so.3.0.0

It looks like you’ve installed a bit more than just build-essential since neither aptitude nor libmpc-dev are part of the base OSMC build. It might simply be a bad flash to the SD card that’s causing this issue.

The cause of the problem isn’t clear. Unfortunately, you’ve not supplied any logs and we don’t know what you want to compile, so can’t even try to reproduce it. I see that you’re running as root, which is generally not necessary. Are you, for example, running it in a chroot jail?

Anyway, as a basic test, are you able to compile and run a simple Hello World program?

gcc hello.c; ./a.out

Installed both of those while trying to solve this issue.

I’m trying to install SickChill into a python virtualenv. Getting the error while trying build cffi python package. I’ve posted the exact error that I get when it is building.

I’m willing to provide any logs you can think of.

I’ve also tried using the binary python-cffi, which installs, but pip insists on installing a custom one.

Might be SD card. It got corrupt with previous (3 year old) installation of raspbian. I formatted and installed osmc. Very impressed with how easy everything has been up until now.

Was planning on getting a new SD card anyway, might as well do it now before too much customisation.

Thanks for the responses so far.

Could you perhaps give me md5 of your cc1 and libmpc.so.3?

After getting a few dependencies sorted out, I’ve managed to do a pip install cffi, though not in a python virtualenv.

Could you see what happens with the Hello World build in your normal environment?

And a 3-year old SD card is probably due for a replacement any time soon.

The md5s are:

1738198fa31fe6724d1ca1ffec19117c  /usr/lib/gcc/arm-linux-gnueabihf/6/cc1
565b5dfc16a6a2aeef64a7be1a46d532  /usr/lib/arm-linux-gnueabihf/libmpc.so.3.0.0

My libmpc is different:

1738198fa31fe6724d1ca1ffec19117c  /usr/lib/gcc/arm-linux-gnueabihf/6/cc1
6f0d36950e0f2845dffaa15654594ec0  /usr/lib/arm-linux-gnueabihf/libmpc.so.3.0.0

Strange thing is that I did reinstall it, which should have replaced it with the version from the deb package.

Hello World:

osmc@lounge:/tmp$ gcc hello.c
/usr/lib/gcc/arm-linux-gnueabihf/6/cc1: error while loading shared libraries: libmpc.so.3: cannot open shared object file: No such file or directory

Could you give me your libmpc.so.3.0.0 to try?

I just realized that I didn’t actually reinstall libmpc3; I reinstalled cpp-6. It works after executing the following command:

apt-get --reinstall install libmpc3

Thank you!! I really appreciate your help.

Perhaps Santa will bring you s new SD card, as well. :wink:

You might need this command to run -

export LD_LIBRARY_PATH="/usr/local/lib"

No need to resurrect an year old (solved) post.

1 Like