linux系统无法找到libexpat

时间:2014-02-04 15:55:52

标签: c++ linux shared-libraries

我正在为ubuntu 12.10 i386开发vddk库。我不断得到以下错误:

Cannot open library: libexpat.so.0: cannot open shared object file: No such file or directory.

当我运行apt-file search libexpat.so时 它向我展示了

lib64expat1: /usr/lib64/libexpat.so.1
lib64expat1: /usr/lib64/libexpat.so.1.6.0
lib64expat1-dev: /usr/lib64/libexpat.so
libexpat1: /lib/i386-linux-gnu/libexpat.so.1
libexpat1: /lib/i386-linux-gnu/libexpat.so.1.6.0
libexpat1-dev: /usr/lib/i386-linux-gnu/libexpat.so

我已经尝试创建符号链接

sudo ln -s /usr/lib/i386-linux-gnu/libexpat.so /usr/lib/i386-linux-gnu/libexpat.so.0

但它不起作用。 奇怪的是:

 ls -l `locate libexpat.so`
ls: cannot access /lib/i386-linux-gnu/libexpat.so.1: No such file or directory
ls: cannot access /lib/i386-linux-gnu/libexpat.so.1.6.0: No such file or directory
ls: cannot access /usr/lib/vmware-vix-disklib/lib64/libexpat.so.0: No such file or directory
-rw-r--r-- 1 ubuntu ubuntu 141320 Aug 20 09:21 /home/ubuntu/vddk/lib64/libexpat.so.0
-rw-r--r-- 1 root   root   141320 Feb  3 16:45 /usr/lib/vmware-vix-disk-lib/vmware-vix-disk-lib/lib64/libexpat.so.0
-rw-r--r-- 1 root   root   141320 Aug 20 09:21 /usr/vmware-vix-disklib-distrib/lib64/libexpat.so.0

3 个答案:

答案 0 :(得分:5)

apt-file仅显示包的内容,或者根据文件名显示包的内容,但无论是否安装包,它都会起作用。

您需要安装libexpat1

sudo apt-get install libexpat1

如果您要针对libexpat1编译和链接自定义C程序,您还需要:

sudo apt-get install libexpat1-dev

答案 1 :(得分:0)

修正了 在这里手动下载和安装libexpat包表单 http://expat.sourceforge.net/并寻找下载页面。它应该带你到sourceforge页面并选择稳定的包

答案 2 :(得分:0)

转到source code download page并使用正确的标记进行构建。

由于您正在为x86构建,因此您需要像这样运行configure

./configure CFLAGS=-m32