I am using ubuntu 12.04. Every time I start my bash terminal and every time when I finish typing a command(and press enter) , I get this message:
我使用ubuntu 12.04。每当我启动bash终端,每次完成输入命令(并按下enter)时,我都会得到如下信息:
ERROR: ld.so: object '/usr/lib/liblunar-calendar-preload.so' from LD_PRELOAD cannot be preloaded: ignored.
错误:ld.so:/ usr / lib / liblunar-calendar-preload对象”。因此,从LD_PRELOAD无法预加载:忽略。
It is weird. So what is the environment variable LD_PRELOAD used for? And what is the going on behind the scene?
这是奇怪的。那么,环境变量LD_PRELOAD用来做什么呢?那么幕后发生了什么?
Thanks.
谢谢。
5 个解决方案
#1
8
The linker takes some environmental variables in to acount. one is LD_PRELOAD
链接器将一些环境变量引入到acount中。一个是LD_PRELOAD
from man 8 ld-linux
:
来自man 8 ld-linux:
LD_PRELOAD
A whitespace-separated list of additional, user-specified, ELF
shared libraries to be loaded before all others. This can be
used to selectively override functions in other shared
libraries. For setuid/setgid ELF binaries, only libraries in
the standard search directories that are also setgid will be
loaded.
Therefore the linker will try to load libraries listed in the LD_PRELOAD
variable before others are loaded.
因此,链接器将尝试加载LD_PRELOAD变量中列出的库,然后再加载其他库。
What could be the case that inside the variable is listed a library that can't be preloaded. look inside your .bashrc
or .bash_profile
environment where the LD_PRELOAD
is set and remove that library from the variable.
在变量中可以列出一个不能预加载的库。查看您的.bashrc或.bash_profile环境,在其中设置LD_PRELOAD并从变量中删除该库。
#2
7
If you want to make sure that the library is loaded if and only if the program lunar-calendar-gtk
is launched, you can apply this:
如果您希望确保库是加载的,并且只有在启动程序lunar-calendar-gtk时,您可以应用这个:
You set the environment variable per command by prefixing the command with it:
通过使用以下命令来设置每个命令的环境变量:
$ LD_PRELOAD="liblunar-calendar-preload.so" printenv "LD_PRELOAD"
liblunar-calendar-preload.so
$ printenv "LD_PRELOAD"
$
You can then choose to put this in a shell script and make lunar-calendar-gtk
a symlink to this shell script, replaceing the original referencee. This effectively makes sure that the library is loaded everytime the original application is executed.
然后,您可以选择将其放入一个shell脚本中,并使lunar-calendar-gtk与这个shell脚本相关联,替换原来的引用。这样可以有效地确保每次执行原始应用程序时都加载了库。
You will have to rename the original lunar-calendar-gtk
to something else, which might not be too intriguing as it possibly may cause issues with uninstallation and upgrading. However, I found it useful with a former version of Skype.
您将不得不将原始的lunar-calendar-gtk重命名为其他东西,这可能不会太引人注意,因为它可能会导致卸载和升级问题。然而,我发现它与以前版本的Skype很有用。
#3
2
Thanks for the responses. I think I've solved the problem just now.
谢谢你的回复。我想我刚才已经解决了这个问题。
Since LD_PRELOAD is for setting some library proloaded, I check the library that ld preloads with LD_PRELOAD, one of which is "liblunar-calendar-preload.so", that is not existing in the path "/usr/lib/liblunar-calendar-preload.so", but I find a similar library "liblunar-calendar-preload-2.0.so", which is a difference version of the former one.
因为LD_PRELOAD是用来设置一些库的,所以我检查了带有LD_PRELOAD的ld预加载的库,其中一个是“liblunar-calendar-preload”。因此,“在路径中不存在”/usr/lib/liblunar-calendar-preload。所以“,但我发现了一个类似的库”liblunar-calendar- preload2.0。所以,这是前一个版本的不同版本。
Then I guess maybe liblunar-calendar-preload.so was updated to a 2.0 version when the system updated, leaving LD_PRELOAD remain to be "/usr/lib/liblunar-calendar-preload.so". Thus the preload library name was not updated to the newest version.
然后我猜可能是liblunar-calendar-preload。当系统更新时,更新到2.0版本,留下LD_PRELOAD仍然是“/usr/lib/liblunar-calendar- preloadso”。因此,预加载库名称没有更新到最新版本。
To avoid changing environment variable, I create a symbolic link under the path "/usr/lib"
为了避免更改环境变量,我在path“/usr/lib”下创建了一个符号链接。
sudo ln -s liblunar-calendar-preload-2.0.so liblunar-calendar-preload.so
Then I restart bash, the error is gone.
然后重启bash,错误就消失了。
#4
2
It means the path you input caused an error. In your LD_PRELOAD
command, modify the path like the error tips:
这意味着您输入的路径会导致错误。在LD_PRELOAD命令中,修改路径,如错误提示:
/usr/lib/liblunar-calendar-preload.so
#5
0
This may happen when you remove some software, reboot you computer.
这可能发生在你删除一些软件,重新启动你的电脑。
Today I install some software and do apt remove xxx
and apt-get auroremove
, I get this error. When grep it in my computer I cannot find this. This error occurs no matter what command I execute. But after I reboot my computer, it gone.
今天我安装了一些软件,并做了适当的删除xxx和apt-get auroremove,我得到了这个错误。在我的电脑里,我找不到这个。无论我执行什么命令,都会出现此错误。但当我重启电脑后,它就消失了。
#1
8
The linker takes some environmental variables in to acount. one is LD_PRELOAD
链接器将一些环境变量引入到acount中。一个是LD_PRELOAD
from man 8 ld-linux
:
来自man 8 ld-linux:
LD_PRELOAD
A whitespace-separated list of additional, user-specified, ELF
shared libraries to be loaded before all others. This can be
used to selectively override functions in other shared
libraries. For setuid/setgid ELF binaries, only libraries in
the standard search directories that are also setgid will be
loaded.
Therefore the linker will try to load libraries listed in the LD_PRELOAD
variable before others are loaded.
因此,链接器将尝试加载LD_PRELOAD变量中列出的库,然后再加载其他库。
What could be the case that inside the variable is listed a library that can't be preloaded. look inside your .bashrc
or .bash_profile
environment where the LD_PRELOAD
is set and remove that library from the variable.
在变量中可以列出一个不能预加载的库。查看您的.bashrc或.bash_profile环境,在其中设置LD_PRELOAD并从变量中删除该库。
#2
7
If you want to make sure that the library is loaded if and only if the program lunar-calendar-gtk
is launched, you can apply this:
如果您希望确保库是加载的,并且只有在启动程序lunar-calendar-gtk时,您可以应用这个:
You set the environment variable per command by prefixing the command with it:
通过使用以下命令来设置每个命令的环境变量:
$ LD_PRELOAD="liblunar-calendar-preload.so" printenv "LD_PRELOAD"
liblunar-calendar-preload.so
$ printenv "LD_PRELOAD"
$
You can then choose to put this in a shell script and make lunar-calendar-gtk
a symlink to this shell script, replaceing the original referencee. This effectively makes sure that the library is loaded everytime the original application is executed.
然后,您可以选择将其放入一个shell脚本中,并使lunar-calendar-gtk与这个shell脚本相关联,替换原来的引用。这样可以有效地确保每次执行原始应用程序时都加载了库。
You will have to rename the original lunar-calendar-gtk
to something else, which might not be too intriguing as it possibly may cause issues with uninstallation and upgrading. However, I found it useful with a former version of Skype.
您将不得不将原始的lunar-calendar-gtk重命名为其他东西,这可能不会太引人注意,因为它可能会导致卸载和升级问题。然而,我发现它与以前版本的Skype很有用。
#3
2
Thanks for the responses. I think I've solved the problem just now.
谢谢你的回复。我想我刚才已经解决了这个问题。
Since LD_PRELOAD is for setting some library proloaded, I check the library that ld preloads with LD_PRELOAD, one of which is "liblunar-calendar-preload.so", that is not existing in the path "/usr/lib/liblunar-calendar-preload.so", but I find a similar library "liblunar-calendar-preload-2.0.so", which is a difference version of the former one.
因为LD_PRELOAD是用来设置一些库的,所以我检查了带有LD_PRELOAD的ld预加载的库,其中一个是“liblunar-calendar-preload”。因此,“在路径中不存在”/usr/lib/liblunar-calendar-preload。所以“,但我发现了一个类似的库”liblunar-calendar- preload2.0。所以,这是前一个版本的不同版本。
Then I guess maybe liblunar-calendar-preload.so was updated to a 2.0 version when the system updated, leaving LD_PRELOAD remain to be "/usr/lib/liblunar-calendar-preload.so". Thus the preload library name was not updated to the newest version.
然后我猜可能是liblunar-calendar-preload。当系统更新时,更新到2.0版本,留下LD_PRELOAD仍然是“/usr/lib/liblunar-calendar- preloadso”。因此,预加载库名称没有更新到最新版本。
To avoid changing environment variable, I create a symbolic link under the path "/usr/lib"
为了避免更改环境变量,我在path“/usr/lib”下创建了一个符号链接。
sudo ln -s liblunar-calendar-preload-2.0.so liblunar-calendar-preload.so
Then I restart bash, the error is gone.
然后重启bash,错误就消失了。
#4
2
It means the path you input caused an error. In your LD_PRELOAD
command, modify the path like the error tips:
这意味着您输入的路径会导致错误。在LD_PRELOAD命令中,修改路径,如错误提示:
/usr/lib/liblunar-calendar-preload.so
#5
0
This may happen when you remove some software, reboot you computer.
这可能发生在你删除一些软件,重新启动你的电脑。
Today I install some software and do apt remove xxx
and apt-get auroremove
, I get this error. When grep it in my computer I cannot find this. This error occurs no matter what command I execute. But after I reboot my computer, it gone.
今天我安装了一些软件,并做了适当的删除xxx和apt-get auroremove,我得到了这个错误。在我的电脑里,我找不到这个。无论我执行什么命令,都会出现此错误。但当我重启电脑后,它就消失了。