1、问题现象
- 在文件界面打开终端的时候,突然发现开头有一堆报错
ERROR: ld.so: object './envlib.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object './libharfbuzz.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object './envlib.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object './libharfbuzz.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object './envlib.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object './libharfbuzz.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
像这样的报错后面还有10几行,但是表示的意思都是/envlib.so,/libharfbuzz.so.0 这两个文件无法预加载
2、问题分析
- 通过查阅网上的博客发现这个LD_PRELOAD 是 Linux/Unix 系统的一个环境变量,它影响程序的运行时的链接(Runtime linker),它允许在程序运行前定义优先加载的动态链接库。
- 然后我就开始找这个变量在哪里定义了,.bashrc里没有,.bash_profile这个文件我都没有
- 最后在终端执行 env | grep LD_PRELOAD, 打印输出了如下内容:
$ env | grep LD_PRELOAD
ERROR: ld.so: object './envlib.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object './libharfbuzz.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object './envlib.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
ERROR: ld.so: object './libharfbuzz.so.0' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
LD_PRELOAD=./envlib.so ./libharfbuzz.so.0
3、解决办法
- 确定了这两个文件确实在环境变量里,用unset命令取消掉
unset LD_PRELOAD
- 后面就没有报错了