问题
Today I updated my laptop to Ubuntu 18.04. Now I try to run a program for my bachelor thesis, but it gives me the following error message:
error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory
I did a bit of research, and I think libmpfr4 has been droppen in this ubuntu version. Is there any way I can solve this?
回答1:
I had the same problem and solved it by creating symbolic link:
sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
Bear in mind that this is just workaround which might trigger other issues for your case. However, this might save you the day in cases when the problematic program is just a mean to achieve something else.
回答2:
When you get such an error, this means that you generally need to recompile your program.
Alternatively, you may install the old MPFR 3.x version (which corresponds to libmpfr.so.4
) if available, otherwise from an earlier Ubuntu release (I do not recommend that, but if there are no conflicts from the packaging system, this could be OK; FYI, in Debian, both packages libmpfr4
and libmpfr6
are co-installable).
Note: Contrary to what has been said in the comments, libmpfr.so.4
is no longer there if you're using the 64-bit ABI (x86_64), as ldconfig -p | grep mpfr
gave for this file: /usr/lib/i386-linux-gnu/libmpfr.so.4
, i.e. the 32-bit version. I suspect that the upgrade removed the x86_64 one (either due to a conflict or because it was no longer needed).
来源:https://stackoverflow.com/questions/51288467/cannot-open-libmpfr-so-4-after-update-on-ubuntu-18-04