Unix & Linux Asked by Agustin Barrachina on January 28, 2021
So I’m running a program a college wrote on debian. When I do, the following error arises:
error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory
I tried installing the following packages because of different search results I did:
apt-get install libmariadbclient-dev-compat
apt-get install default-libmysqlclient-dev
apt-get install mysql-common
Searches like:
find . -name 'libmysqlclient*'
locate libmysqlclient.so
Get’s nothing as output.
I found a supposed fix using yum but as I am using debian it’s not a solution for me.
I found the .20 is something about Oracle MySQL 5.7
(https://community.centminmod.com/threads/libmysqlclient-so-missing.9052/)
Does anybody know how to fix the problem? Thanks in advance.
Apparently the program was compiled against a version of MySQL downloaded from www.mysql.com; libmysqlclient.so.20 was not available in Debian.
You can download a .deb from https://dev.mysql.com/downloads/file/?id=477124 that configures your Debian(-based) system to access the www.mysql.com apt repository. You can then update the apt data:
# apt-get update
and install the correct library:
# apt-get install libmysqlclient20
Note that this will probably want to remove your Debian version of MySQL, if installed! So consider carefully what you want.
An alternative is to browse the apt repository, and download just the libmysqlclient20 .deb manually. Unpack this, e.g.:
# dpkg-deb --extract libmysqlclient20_5.7.23-1debian9_amd64.deb /tmp/libmysqlclient20
You could then copy the libmysqlclient.so.20 to somewhere that's searched for shared libraries, e.g. /usr/local/lib/ and it should work.
Correct answer by wurtel on January 28, 2021
In case someone else is running into this problem on Ubuntu 20.04, you can just add the older repos which will contain libmysqlclient20
to your APT sources (similar to Jylia Silver's answer.
sudo tee /etc/apt/sources.list.d/xenial.list > /dev/null <<EOF
deb http://dk.archive.ubuntu.com/ubuntu/ xenial main
deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe
deb http://dk.archive.ubuntu.com/ubuntu/ xenial-updates universe
EOF
sudo apt-get update
sudo apt-get install -y libmysqlclient20
Answered by Karl Wilbur on January 28, 2021
echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list
apt-get update
apt-get install libmysqlclient20
Answered by Jylia Silver on January 28, 2021
Alternatively to the correct solution from wurtel, an unsafe, dirty, not suitable for production, hacky method is to simply create a symbolic link from a close enough version to the file the program is looking for:
ln -s /usr/lib/libmysqulclient.so.23 /usr/local/lib/libmysqlclient.so.20
It may work or not. Most of the time, if the source file is only slightly newer, it should be fine. Of course I reiterate that this is unsafe and just for tests.
Answered by wazoox on January 28, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP