gpt4 book ai didi

shared-libraries - 无法打开共享对象文件,但库文件就在那里

转载 作者:行者123 更新时间:2023-12-02 01:54:54 26 4
gpt4 key购买 nike

我正在使用名为“md”的程序,它需要一个名为“beagle”的库。我将库安装到/usr/local/lib:

$ ls /usr/local/lib/libhmsbeagle*
/usr/local/lib/libhmsbeagle-cpu.la /usr/local/lib/libhmsbeagle-cpu-sse.so /usr/local/lib/libhmsbeagle.la
/usr/local/lib/libhmsbeagle-cpu.so /usr/local/lib/libhmsbeagle-cpu-sse.so.21 /usr/local/lib/libhmsbeagle.so
/usr/local/lib/libhmsbeagle-cpu.so.21 /usr/local/lib/libhmsbeagle-cpu-sse.so.21.0.0 /usr/local/lib/libhmsbeagle.so.1
/usr/local/lib/libhmsbeagle-cpu.so.21.0.0 /usr/local/lib/libhmsbeagle-jni.la /usr/local/lib/libhmsbeagle.so.1.1.1
/usr/local/lib/libhmsbeagle-cpu-sse.la /usr/local/lib/libhmsbeagle-jni.so

然后我运行程序,它叫道:

./mb: error while loading shared libraries: libhmsbeagle.so.1: cannot open shared object file: No such file or directory

我猜它可能找不到/usr/local/lib 中的东西,所以我将所有东西都链接到/usr/local/lib64,但程序报了同样的错误。

最后我将该文件链接到当前目录:

$ ln -s /usr/local/lib/libhmsbeagle.so.1 ./
$ ll libhmsbeagle.so.1
lrwxrwxrwx. 1 yx yx 32 Dec 24 20:50 libhmsbeagle.so.1 -> /usr/local/lib/libhmsbeagle.so.1

程序仍然有同样的错误。

我确定程序和库都是 ELF64:

$ readelf -h mb
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x402164
Start of program headers: 64 (bytes into file)
Start of section headers: 1724208 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 9
Size of section headers: 64 (bytes)
Number of section headers: 37
Section header string table index: 34
$ readelf -h libhmsbeagle.so.1
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
Entry point address: 0x39e0
Start of program headers: 64 (bytes into file)
Start of section headers: 41864 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 7
Size of section headers: 64 (bytes)
Number of section headers: 30
Section header string table index: 27

那么,为什么?!!

最佳答案

通过在 root 上运行 ldconfig 解决。我以前从未使用过 ldconfig。为什么有时我需要在安装一个新的 .so 文件后运行它,但大多数时候不需要?

关于shared-libraries - 无法打开共享对象文件,但库文件就在那里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20761954/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com