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

12,021

Solution 1

I fixed this problem with sysmlinks

$vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
include /usr/local/lib
/usr/lib
/usr/local/lib
$/sbin/ldconfig
$ln -s /usr/local/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1

Solution 2

Assuming you have installed the libraries to /usr/local/lib, which is the default, the correct answer is to run /sbin/ldconfig as root/sudo.

On some systems you will need to add /usr/local/lib to the paths that ld caches, e.g.

echo /usr/local/lib > /etc/ld.so.conf.d/local.conf

Solution 3

This indicates that the linker does not know where to find the library. Just run sudo /sbin/ldconfig to update the linker cache of libraries. This is not something that is unique to mosquitto.

Share:
12,021
user1048839
Author by

user1048839

Updated on June 08, 2022

Comments

  • user1048839
    user1048839 about 2 years

    I encountered this problem when I compiled mosquitto on my Fedora 21 box from source.

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

    The clients (i.e mosquitto_pub and mosquitto_sub) keep throwing that error even with reinstallation.