Ldd在不同的Ubuntu机器之间的相同c ++可执行文件上显示不同版本的库

时间:2021-03-13 23:41:11

I have created a c++ app that needs libboost_iostreams.so.1.63.0 library. In a Ubuntu 16.04 VM I have built the library and the ldd command on my executable gives the following:

我创建了一个需要libboost_iostreams.so.1.63.0库的c ++应用程序。在Ubuntu 16.04 VM中,我已经构建了库,并且我的可执行文件上的ldd命令提供了以下内容:

ldd ./c++_app | grep boost

libboost_iostreams.so.1.63.0 => /usr/local/lib/libboost_iostreams.so.1.63.0 (0x00007f7a52e62000)

Then I zip the app with the relevant shared lib in order to install it on new VM which has not the boost 1.63 library built.
I install the c++ on /usr/bin and the library on a folder lib in /usr/share-data and then update the /etc/ld.so.conf so that it can find the new library
However when I give:

然后我将应用程序与相关的共享库压缩,以便将其安装在没有构建boost 1.63库的新VM上。我将/ usr / bin上的c ++和库安装在/ usr / share-data中的文件夹lib上,然后更新/etc/ld.so.conf以便它可以找到新库但是当我给出时:

 sudo ldconfig -p | grep boost

I get

 libboost_iostreams.so.1.63.0 (libc6,x86-64) => /usr/share/lib/libboost_iostreams.so.1.63.0

but when I give ldd on the binary file in /usr/bin I get

但是当我在/ usr / bin中的二进制文件上给ldd时,我得到了

ldd c++_app | grep boost
libboost_iostreams.so.1.62.0 => not found

What I have done wrong here?

我在这做错了什么?

1 个解决方案

#1


0  

Try export LD_LIBRARY_PATH=/usr/share/lib. This should help you

尝试导出LD_LIBRARY_PATH = / usr / share / lib。这应该对你有帮助

#1


0  

Try export LD_LIBRARY_PATH=/usr/share/lib. This should help you

尝试导出LD_LIBRARY_PATH = / usr / share / lib。这应该对你有帮助