库链接到/usr/lib64,但我需要来自/usr/local/lib64的库

时间:2022-04-19 15:34:19

I'm getting this weird problem

我遇到了这个奇怪的问题

ag: /usr/lib64/liblzma.so.5: no version information available (required by ag)

For some reason the preinstalled library is no good. Okay, so I install liblzma from source, but how do I link against it? The makefile already says:

由于某种原因,预安装库不是很好。好的,我从源代码中安装了liblzma,但是如何链接到它呢?makefile已经表示:

-L/usr/local/lib64 -llzma 

But here's the result, it will still take /usr/lib64 by default apparently: ldd ag

但结果是,默认情况下仍然需要/usr/lib64: ldd ag

liblzma.so.5 => /usr/lib64/liblzma.so.5

2 个解决方案

#1


1  

update your /etc/ld.so.conf to make /usr/local/lib64 before /usr/lib64 ? and then run ldconfig as root

更新你的/etc/ld.so.conf在/usr/lib64之前做/usr/local/lib64 ?然后运行ldconfig作为根

#2


1  

For some reason the preinstalled library is no good.

由于某种原因,预安装库不是很好。

Your best bet is to try to figure out why preinstalled library is no good, and fix the root cause.

最好的办法是尝试找出为什么预安装库不好,并修复根本原因。

If you can't, your next best bet is to build your executable ag with -Wl,-rpath=/usr/local/lib64.

如果不能,您的下一个最佳选择是使用-Wl、-rpath=/usr/local/lib64构建可执行ag。

Updating /etc/ld.so.conf (as suggested by frostyplanet) is probably the worst solution possible: it will affect every executable on your system. If you start installing more stuff into /usr/local/lib64, currently-working applications may suddenly break in unpredictable fashion.

更新/etc/ld.so.conf(正如frostyplanet所建议的)可能是最糟糕的解决方案:它将影响您系统上的每个可执行文件。如果您开始在/usr/local/lib64中安装更多的内容,那么当前工作的应用程序可能会突然以不可预知的方式中断。

#1


1  

update your /etc/ld.so.conf to make /usr/local/lib64 before /usr/lib64 ? and then run ldconfig as root

更新你的/etc/ld.so.conf在/usr/lib64之前做/usr/local/lib64 ?然后运行ldconfig作为根

#2


1  

For some reason the preinstalled library is no good.

由于某种原因,预安装库不是很好。

Your best bet is to try to figure out why preinstalled library is no good, and fix the root cause.

最好的办法是尝试找出为什么预安装库不好,并修复根本原因。

If you can't, your next best bet is to build your executable ag with -Wl,-rpath=/usr/local/lib64.

如果不能,您的下一个最佳选择是使用-Wl、-rpath=/usr/local/lib64构建可执行ag。

Updating /etc/ld.so.conf (as suggested by frostyplanet) is probably the worst solution possible: it will affect every executable on your system. If you start installing more stuff into /usr/local/lib64, currently-working applications may suddenly break in unpredictable fashion.

更新/etc/ld.so.conf(正如frostyplanet所建议的)可能是最糟糕的解决方案:它将影响您系统上的每个可执行文件。如果您开始在/usr/local/lib64中安装更多的内容,那么当前工作的应用程序可能会突然以不可预知的方式中断。