加载共享库时出错:libsandbox.so

use*_*592 3 autoconf gcc sandbox shared-libraries

当我在编译沙箱c程序后尝试运行.out文件时,它会出现以下错误:

    ./sandbox: error while loading shared libraries: libsandbox.so: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我该怎么办?

liu*_*uyu 5

" 共享库失踪 "问题不是唯一的libsandbox.许多使用GNU自动工具进行构建配置的自编译库都会发生这种情况.

问题是GNU autotools /usr/local/lib默认情况下准备库(并且有充分的理由让此设置保持默认值,例如FHS一致性).然而,在一些Linux发行版-像Ubuntu的ArchLinux的 -运行时链接程序(亦称ld.so一样)搜索/usr/local/lib共享库,除非另有规定通过ldconfig.

虽然从@安东·科瓦连科的回答所有其他解决方案是可行的,它可能是更方便,如果你只是配置libsandbox的选项--prefix=/usr--libdir=/usr/lib(如果你有写权限/usr/lib,当然).或者,您可以添加新ldconfig条目/etc/ld.so.conf.d/usr/local/lib在系统级别启用库搜索.

免责声明:我是作者libsandbox.