ldconfig etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
ldconfig etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

16 Şubat 2018 Cuma

ldconfig komutu

Giriş
ldconfig loader tarafından kullanılan .so dosyalarını cache'lemek için kullanılır. Açıklaması şöyle.
When the loader is looking for the shared libraries needed to assemble a new process, it does not search all of the linker's default search directories. That would be slow. By default it searches a cached database /etc/ld.so.cache, of libraries that were found by ldconfig, last time it was run.
ldconfig hangi dizinler arar
Açıklaması şöyle.
By default, ldconfig caches libraries that it finds in /lib, /usr/lib and in the directrories listed in the file /etc/ld.so.conf, and/or any similar *.conf files that are recursively include-ed in /etc/ld.so.conf
Bu dosyaların içi şöyledir
$ cat /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf

$ cat /etc/ld.so.conf.d/*.conf
/usr/lib/x86_64-linux-gnu/libfakeroot
# libc default configuration
/usr/local/lib
# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
/usr/lib/nvidia-384
/usr/lib32/nvidia-384
/usr/lib/nvidia-384
/usr/lib32/nvidia-384
# Legacy biarch compatibility support
/lib32
/usr/lib32
Örnek
Kendimiz yeni bir kütüphane derledikten sonra cache dosyasını tekrar oluşturmak için şöyle yaparız.
ldconfig
Eğer bunu yapmazsak şöyle bir hata alırız.
$ make foo
...
...error while loading shared libraries: libboost_system.so.1.66.0: cannot open
 shared object file: No such file or directory
Eğer kütüphane sistem yolunda değilse
Bir diğer çözüm LD_LIBRARY_PATH değişkeni ile yeni kütüphanenin yolunu göstermek.