Comment ajouter partagée de la bibliothèque de recherche de chemin d'accès à un fichier exécutable?

- Je construire le ffmpeg avec librtmp. Mon librtmp est dans /opt/librtmp/lib. Quand j'execute le ffmpeg, il a dit:

./ffmpeg: error while loading shared libraries: librtmp.so.0: cannot open shared object file: No such file or directory

Je utiliser la commande " ldd " il affiche pas trouvé:

[qty@testing bin]# ldd ffmpeg 
        linux-vdso.so.1 =>  (0x00007fff15576000)
        librtmp.so.0 => not found
        libz.so.1 => /lib64/libz.so.1 (0x00002b9a71e10000)
        libm.so.6 => /lib64/libm.so.6 (0x00002b9a72025000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b9a722a8000)
        libc.so.6 => /lib64/libc.so.6 (0x00002b9a724c3000)
        /lib64/ld-linux-x86-64.so.2 (0x00002b9a71bf2000)

Je sais que mon à:

[qty@testing bin]# ls -alh  /opt/librtmp/lib/
total 300K
drwxr-xr-x 3 root root 4.0K Sep 25 17:10 .
drwxr-xr-x 7 root root 4.0K Sep 25 17:10 ..
-rw-r--r-- 1 root root 158K Sep 25 17:10 librtmp.a
lrwxrwxrwx 1 root root   12 Sep 25 17:10 librtmp.so -> librtmp.so.0
-rwxr-xr-x 1 root root 118K Sep 25 17:10 librtmp.so.0
drwxr-xr-x 2 root root 4.0K Sep 25 17:10 pkgconfig

J'ai trouvé plusieurs façons de résoudre le problème

  • modifier /etc/ld..conf, mais il faut un souper utilisateur
  • set variable LD_LIBRARY_PATH, mais il n'est pas conventient aux utilisateurs
  • passer rpath à gcc, à l'instar de ce

configurer args pour mon ffmpeg

PKG_CONFIG_PATH="/opt/librtmp/lib/pkgconfig" ./configure --disable-doc \
--disable-ffserver --disable-avdevice \
--disable-postproc --disable-avfilter --disable-bsfs \
--disable-filters \
--disable-asm \
--disable-bzlib \
--enable-librtmp \
--prefix=/opt/ffmpeg \
--extra-ldflags="-Wl,-rpath,/opt/librtmp/lib"

Assumer il n'y a pas de code source à compiler? Comment ajouter de la bibliothèque partagée de recherche de chemin d'accès à un fichier exécutable ?

J'ai fait un lien symbolique de /usr/lib/i486-linux-gnu/librtmp.donc dans /usr/local/lib ffmpeg fonctionne comme un charme...

OriginalL'auteur qrtt1 | 2012-09-25