Varnish: varnishhist/varnishtop: error while loading shared libraries: libvarnishapi.so.1: cannot open shared object file

This isn’t actually a Varnish problem, it’s most likely just your system not having an up-to-date linker to point to your correct modules.

You’ll see this when trying to run varnishhist or varnishtop:

# varnishhist
varnishhist: error while loading shared libraries: libvarnishapi.so.1: cannot open shared object file: No such file or directory


It’s usually as simple as running ldconfig:

# ldconfig

If you have Varnish installed in some obscure location, you may have to add that location manually first.

# ldconfig -n /usr/local/lib/

If that still doesn’t work, make sure you installed it correctly with the correct packages as dependency (Varnish won’t tell you these have been missed during configure & make).

# apt-get install libpcre3-dev libncurses3-dev automake autoconf libtool

And don’t forget to run ‘make clean’ before you try to reconfigure.