Linux下查找和安装依赖的.so文件

以解决Webex在Linux下运行问题为例说明查找和安装依赖的.so文件方法:

查找依赖的.so文件

$ ldd $HOME/.webex/1324/*.so | grep 'not found'
    libgtk-x11-2.0.so.0 => not found
    libgdk-x11-2.0.so.0 => not found
    libXmu.so.6 => not found
    libXtst.so.6 => not found
    libjawt.so => not found
    libjawt.so => not found
    libXmu.so.6 => not found
    libpangoxft-1.0.so.0 => not found
    libXft.so.2 => not found
    libpangoft2-1.0.so.0 => not found
    libpangox-1.0.so.0 => not found

安装.so查找工具apt-file

sudo apt-get install apt-file
apt-file update

使用apt-file查找.so所在的deb包

$ apt-file search libXmu.so.6
libxmu6: /usr/lib/x86_64-linux-gnu/libXmu.so.6
libxmu6: /usr/lib/x86_64-linux-gnu/libXmu.so.6.2.0
libxmu6-dbg: /usr/lib/debug/usr/lib/x86_64-linux-gnu/libXmu.so.6.2.0

安装对应的数据包

sudo apt-get install -y libgtk2.0-0:i386
sudo apt-get install -y libxmu6:i386
sudo apt-get install -y libgcj14-awt:i386
sudo apt-get install -y libpangoxft-1.0-0:i386
sudo apt-get install -y libxft2:i386
sudo apt-get install -y libpangoft2-1.0-0:i386
sudo apt-get install -y libpangox-1.0-0:i386

ldd命令说明

http://blog.sina.com.cn/s/blog_4d6d0dd201000bda.html
http://blog.csdn.net/cyberrusher/article/details/7250824

ldd的作用是打印可执行档依赖的共享库文件。它是glibc的一部分,由Roland McGrath和Ulrich Drepper维护

但是ldd本身不是一个程序,而仅是一个shell脚本:

$ which ldd
/usr/bin/ldd
$ file /usr/bin/ldd 
/usr/bin/ldd: Bourne-Again shell script text executable
    原文作者:mst7
    原文地址: https://www.jianshu.com/p/1edcf0a9abcb
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞