一、错误现象
在CentOS v6.4 64位系统,使用Tiny210的开发配套光盘提供的arm-linux-gcc-4.5.1-v6-vfp-20120301.tgz编译linux-3.0.8-20130327.tgz内核,会有以下错误:
/opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object
二、解决办法
使用命令ldd /opt/FriendlyARM/toolschain/4.5.1/lib/gcc/arm-none-linux-gnueabi/4.5.1/../../../../arm-none-linux-gnueabi/bin/as 可以看到这里的as依赖于的静态库libz.so.1缺少,用find命令查找,只发现在lib64目录中有该文件,lib目录没有。
在联网的前提下,使用命令yum whatprovides */libz.so.1来查找那些安装包提供了该文件,结果如下:
[root@ken ~]# yum whatprovides */libz.so.1
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: ftp.twaren.net
* extras: ftp.tc.edu.tw
* updates: ftp.nsysu.edu.tw
zlib-1.2.3-29.el6.x86_64 : The zlib compression and decompression library
Repo : base
Matched from:
Filename : /lib64/libz.so.1
zlib-1.2.3-29.el6.i686 : The zlib compression and decompression library
Repo : base
Matched from:
Filename : /lib/libz.so.1
zlib-1.2.3-29.el6.x86_64 : The zlib compression and decompression library
Repo : installed
Matched from:
Filename : /lib64/libz.so.1
zlib-1.2.3-29.el6.i686 : The zlib compression and decompression library
Repo : installed
Matched from:
Filename : /lib/libz.so.1
可见/lib/libz.so.1是zlib-1.2.3-2.9.e16.i686提供的,因此使用yum install zlib.i686来进行安装,安装完成后,重新编译,成功通过。