加载共享库时出错:libboost_system.so.1.45.0:无法打开共享对象文件:没有这样的文件或目录 [英] error while loading shared libraries: libboost_system.so.1.45.0: cannot open shared object file: No such file or directory

查看:6632
本文介绍了加载共享库时出错:libboost_system.so.1.45.0:无法打开共享对象文件:没有这样的文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux上构建一个C ++可执行文件。



这是我尝试运行二进制文件时的输出:

  root @ yourbox:〜/ work / dev / c ++ / projects / testfgci / dist / Debug / GNU-Linux-x86 $ ./testfgci 
./testfgci:库:libboost_system.so.1.45.0:无法打开共享对象文件:无此类文件或目录

然后我在二进制文件上运行ldd以检查依赖关系:

  root @ yourbox:〜/ work / dev / c ++ / projects / testfgci / dist / Debug / GNU-Linux-x86 $ ldd testfgci 
linux-gate.so.1 => (0x00380000)
libboost_system.so.1.45.0 =>未找到
libstdc ++。so.6 => /usr/lib/libstdc++.so.6(0x00b50000)
libm.so.6 => /lib/tls/i686/cmov/libm.so.6(0x005f6000)
libgcc_s.so.1 => /lib/libgcc_s.so.1(0x0099a000)
libc.so.6 => /lib/tls/i686/cmov/libc.so.6(0x001b3000)
libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0(0x00110000)
/lib/ld-linux.so.2(0x00ea2000)

我不知道为什么找不到liboos_system.sl.1.45.0 SO。我在今天早些时候成功了。任何人都可以解释?

解决方案

找不到库。



默认情况下,库是在 / lib / usr / lib /etc/ld.so.conf



通常系统库(例如boost,如果通过软件包管理器安装)在 / usr / lib 中,但可能不是您的情况。



?你自己编译它们吗?在这种情况下,你应该告诉动态链接器通过使用 LD_LIBRARY_PATH 环境变量在它们所在的目录中查找你的库:

  LD_LIBRARY_PATH =您的/ boost /目录./testfgci 


b $ b

我建议你使用你的包管理器安装boost库,无论如何,这将使你的生活更简单。


I am building a C++ executable on Linux. The executable links into some boost libraries.

This is the output when I attempt to run the binary:

root@yourbox:~/work/dev/c++/projects/testfgci/dist/Debug/GNU-Linux-x86$ ./testfgci 
./testfgci: error while loading shared libraries: libboost_system.so.1.45.0: cannot open shared object file: No such file or directory

I then run ldd on the binary to check dependencies:

root@yourbox:~/work/dev/c++/projects/testfgci/dist/Debug/GNU-Linux-x86$ ldd testfgci 
    linux-gate.so.1 =>  (0x00380000)
    libboost_system.so.1.45.0 => not found
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00b50000)
    libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0x005f6000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x0099a000)
    libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0x001b3000)
    libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0x00110000)
    /lib/ld-linux.so.2 (0x00ea2000)

I am not sure why the liboos_system.sl.1.45.0 SO is not found. I built it successfully a little earlier on today. Can anyone explain?

解决方案

The library cannot be found.

Libraries are by default looked for in /lib, /usr/lib and the directories specified by /etc/ld.so.conf.

Usually system libraries (like boost, if you installed it via your package manager) are located in /usr/lib, but it's probably not your case.

Where are your boost libraries located on your system? Did you compile them by yourself? In this case you should tell the dynamic linker to look for your libraries in the directory they're located by using the LD_LIBRARY_PATH environment variable:

LD_LIBRARY_PATH="your/boost/directory" ./testfgci

I'd suggest you to install boost libraries using your package manager, anyway, this will make your life a lot simpler.

这篇关于加载共享库时出错:libboost_system.so.1.45.0:无法打开共享对象文件:没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆