Saturday, March 08, 2008

FreeBSD ldconfig

In orde to configure the shared library cache for ELF format on FreeBSD, you can add all the directories that contain the shared libraries to /etc/ld-elf.so.conf.

shell>cat /etc/ld-elf.so.conf
/lib
/usr/lib
/usr/lib/compat
/usr/local/lib
/usr/local/lib/compat
/usr/local/lib/compat/pkg
/usr/local/lib/graphviz
/usr/local/lib/mysql
/usr/local/lib/nss
/usr/local/lib/pth
/usr/local/share

Then run -

shell>ldconfig -elf /etc/ld-elf.so.conf

Now you can check the hints file -

shell>strings /var/run/ld-elf.so.hints
Ehnt
/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat:
/usr/local/lib/compat/pkg:/usr/local/lib/graphviz:
/usr/local/lib/mysql:/usr/local/lib/nss:
/usr/local/lib/pth:/usr/local/share


All of them are added now. If you have shared object missing or not found error when you launch certain application next time, please add the directories that containing its shared library in /etc/ld-elf.so.conf and follow the steps above will do.

Peace ;]

1 comment:

Tim Cooper said...

Thanks for the tip, I somehow messed up ldconfig, and now my linux binaries attempt to use freebsd libraries instead of the libraries in /compat/linux :(