且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Linux程序在运行时找不到共享库

更新时间:2023-11-16 23:45:04

您已经构建了一个动态链接的可执行文件,它希望链接到libid3-3.8.so。 3在执行时。这在构建阶段可能与 -L / path / to / libid3 / directory -lid3 有关。

You have built a dynamically-linked executable, that wishes to be linked against libid3-3.8.so.3 at execution time. This was likely linked during the build phase with something like -L/path/to/libid3/directory -lid3.

您有一些选项可使 libid3 可用,通常按优先顺序排列(因为您没有提及文件的位置,我只能是一般的):

You have a few options to make libid3 available, in generally decreasing order of preference (since you didn't mention where the file was, I can only be general):


  • 创建一个符号链接到 libid3 * /etc/ld.so.conf (或 / lib / usr / lib $ c>)

  • libid3 * 复制到 / etc /ld.so.conf (或 / lib / usr / lib )默认值)

  • 将包含 libid3 * 的目录添加到 /etc/ld.so.conf

  • 在运行您的id3v2可执行文件之前,将 LD_LIBRARY_PATH = / directory / path /设置为/ libid3 *
  • 静态地重新编译 id3v2

  • Create a symlink to libid3* in a directory listed in /etc/ld.so.conf (or /lib or /usr/lib)
  • Copy libid3* to a directory listed in /etc/ld.so.conf (or /lib or /usr/lib) (defaults)
  • Add the directory containing libid3* to /etc/ld.so.conf
  • Set LD_LIBRARY_PATH=/directory/path/to/libid3* before running your id3v2 executable.
  • Recompile id3v2 statically. (It will work, but don't bother.)

在任何前3个之后,重新运行 ldconfig ,以便更新链接器缓存。 (您可以运行 ldconfig -v 以验证它是否可解析。)

After any of the first 3, rerun ldconfig so the linker cache is updated. (You can then run ldconfig -v to verify it's resolvable.)

注意这些不是步骤, '选项。你只需要做其中的1个。

Note those aren't steps, they're options. You only need to do 1 of them.

很高兴你更新了标题。 #include 指令与链接无关。

Glad you updated the title. #include directives have nothing to do with linking.