项目背景:
在Ubuntu上,使用zbar库识别二维码,安装了 zbar的库
测试本地动态链接库ldconfig 命令
#apt-get install libzbar-dev
#apt-get install zbar-tools
测试二维码库Zbar的代码:
zbarimg 1.png
//输出结果
QR-Code:1788
QR-Code:178813
QR-Code:178812
QR-Code:178814
scanned 4 barcode symbols from 1 images in 0.44 secondsldconfig -p|grep zbar
可以看到有几个链接库
发现一个很奇怪的事情,手动删除了动态链接库,发现zbarimg不能运行,此时还是正常的。 接下来使用 apt-get remove zbar-tools 删除zbar-tools,
又再一次 使用apt-get install zbar-tools 安装完成之后,发现zbarimg并不能运行
报错信息:
zbarimg: error while loading shared libraries: libzbar.so.0: cannot open shared object file: No such file or directory
解决方案
使用 apt-get build-dep zbar-tools
原因:
1、apt-get install 与 apt-get remove
使用remove 命令的时候,软件移除并不干净,使用install时 没有重新安装配置动态链接库
2、apt-get build-dep
apt-get build-dep 命令从源码 配置安装 ,会重新配置依赖项
以下是 man apt-get 命令中 关于 build-dep的解释
build-dep causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package. By default the dependencies are satisfied to build the package natively. If desired a host-architecture can be specified with the --host-architecture option instead.