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

user1048839 picture user1048839 · Jun 16, 2015 · Viewed 12k times · Source

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.

Answer

ralight picture ralight · Jun 16, 2015

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