简体   繁体   English

修复Linux中缺少的Boost共享库

[英]fixing boost shared library missing in linux

I am building a unix c++ program that calls boost, but when i try to run it i get 我正在构建一个调用boost的unix c ++程序,但是当我尝试运行它时,我得到了

 error while loading shared libraries: libboost_filesystem.so.1.42.0: cannot open shared object file: No such file or directory.

I didn't use to get this error before ( even though i was already calling boost ) , though i don't know what triggered the change. 尽管我不知道是什么触发了更改,但我以前从未使用过此错误(即使我已经在调用boost了)。 Anyway - doing ldd on the binary, it indeed shows that the library is missing. 无论如何-在二进制文件上执行ldd,这确实表明该库丢失了。

I guess the solution would be to add in the LD_LIBRARY_PATH a link to the library containing the .so file - but i can't find it. 我猜解决方案是在LD_LIBRARY_PATH中添加一个指向包含.so文件的库的链接-但我找不到它。 Where should it be? 应该在哪里? Is this the right solution? 这是正确的解决方案吗? Note that i don't have sudo privelages on my computer, so i can only change user settings - And also that i'm a linux newb so please try to explain simply... 请注意,我的计算机上没有sudo特权,因此我只能更改用户设置-而且我是linux newb,所以请尝试简单地说明一下...

I think the problem is that you have linked to a very specific version of Boost (1.42.0 in this case). 我认为问题在于您已链接到特定版本的Boost(在本例中为1.42.0)。 This worked as long as Boost existed in that exact version on your system, but as soon as an update to a more recent version of Boost happened, the linked library could no longer be found. 只要Boost存在于您系统上的那个确切版本中,此方法就起作用,但是一旦发生了对Boost的最新版本的更新,就不再能找到链接库。

You might want to adjust your Makefile to link to a more generic version of libboost_filesystem.so . 您可能需要调整Makefile以链接到更通用的libboost_filesystem.so版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM