English 中文(简体)
LD_LIBRaire_PATH 优先程度
原标题:LD_LIBRARY_PATH precedence

I ve just stumbled on some weird behavior: before I launch my application I ve set the LD_LIBRARY_PATH to some local lib directory which contains all needed libs. After launch I have part(the most part) libs are loaded from the LD_LIBRARY_PATH but a few are loaded from the standard /usr/lib(e.g /usr/lib/libQtNetwork.so.4, /usr/lib/libSM.so.6). All those libs are contained in the directory which is listed in the LD_LIBRARY_PATH. Could anyone explain why do I have such behavior? I m not very familiar with a Linux world but this article says that my approach should work

P.S. If I rename /usr/libs to something other I ll have my application running with all libs used from my libs location

事先感谢!

最佳回答

我找到答案,答案是RPATH。 所有Qt图书馆都是用RPATH=$QT_INSTALL_DIR建造的,因此,如果你想在短链氯化石蜡中制造“bundle”,就应当拆除RPATH。 <>RPATH可通过援引tchrpath的指令予以删除。 感谢大家提供帮助!

问题回答

奥基似乎你正在使用Qt,但同样的原则适用,并不具体。

首先要看的是:PATH,环境变量,当时的QTDIR, 然后是LD_LIBRaire_PATH/strong>。

Normally you do not need to "play" with LD_LIBRARY_PATH. If your PATH is correct then you should be fine.

作为附带说明(可能知道): 看到你使用的图书馆能够使用ldd的指挥。 例如:

user@host:~/$ ldd $QTDIR/bin/qmake 
linux-vdso.so.1 =>  (0x00007fff169ff000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fb6bf63e000)
libm.so.6 => /lib/libm.so.6 (0x00007fb6bf3bb000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007fb6bf1a3000)
libc.so.6 => /lib/libc.so.6 (0x00007fb6bee20000)
/lib64/ld-linux-x86-64.so.2 (0x00007fb6bf97e000)

假定您的<>QTDIR enverras。 如果安装的气球分布将步入正轨,请携带QT。 如果您确实安装或编辑了一种习俗,那么你就需要铺路。

Good luck.





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签