rpm包安裝過程中依賴問題“libc.so.6 is needed by XXX”解決方法


rpm包安裝過程中依賴問題“libc.so.6 is needed by XXX”解決方法

折騰了幾天,終於搞定了CentOS上的Canon LBP2900打印機驅動。中間遇到了一些問題,主要是安裝rpm包出現的依賴問題,費盡周折總算是解決了。現在簡單總結一下。

首先說明一下,我用的CentOS版本是6.6,64位。打印機驅動程序是兩個rpm安裝包:cndrvcups-common-2.60-1.x86_64.rpmcndrvcups-capt-2.60-1.x86_64.rpm

執行安裝命令rpm -ivh cndrvcups-common-2.60-1.x86_64.rpm,出現依賴項錯誤,錯誤代碼如下:

[root@cSlave00 RPM]# rpm -ivh cndrvcups-common-2.60-1.x86_64.rpm error: Failed dependencies: libc.so.6 is needed by cndrvcups-common-2.60-1.x86_64 libc.so.6(GLIBC_2.0) is needed by cndrvcups-common-2.60-1.x86_64 libc.so.6(GLIBC_2.1) is needed by cndrvcups-common-2.60-1.x86_64 libc.so.6(GLIBC_2.1.3) is needed by cndrvcups-common-2.60-1.x86_64 libc.so.6(GLIBC_2.3) is needed by cndrvcups-common-2.60-1.x86_64 libdl.so.2 is needed by cndrvcups-common-2.60-1.x86_64 libdl.so.2(GLIBC_2.0) is needed by cndrvcups-common-2.60-1.x86_64 libdl.so.2(GLIBC_2.1) is needed by cndrvcups-common-2.60-1.x86_64 libm.so.6 is needed by cndrvcups-common-2.60-1.x86_64 libm.so.6(GLIBC_2.0) is needed by cndrvcups-common-2.60-1.x86_64 libpthread.so.0 is needed by cndrvcups-common-2.60-1.x86_64 libpthread.so.0(GLIBC_2.0) is needed by cndrvcups-common-2.60-1.x86_64 libpthread.so.0(GLIBC_2.1) is needed by cndrvcups-common-2.60-1.x86_64 libpthread.so.0(GLIBC_2.3.2) is needed by cndrvcups-common-2.60-1.x86_64 librt.so.1 is needed by cndrvcups-common-2.60-1.x86_64 libstdc++.so.6 is needed by cndrvcups-common-2.60-1.x86_64 libstdc++.so.6(CXXABI_1.3) is needed by cndrvcups-common-2.60-1.x86_64

在網上進行一番搜索,解決方法都是安裝缺少的依賴庫即可。但是搜索后發現,本機上有些庫已經安裝了。比如libc.so.6,該庫對應的軟件包名稱為glibc

[root@cSlave00 RPM]# yum list glibc* 已加載插件:fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * base: mirrors.cug.edu.cn * extras: mirrors.cug.edu.cn * updates: mirrors.skyshe.cn 已安裝的軟件包 glibc.x86_64 2.12-1.149.el6 @anaconda-CentOS-201410241409.x86_64/6.6 glibc-common.x86_64 2.12-1.149.el6 @anaconda-CentOS-201410241409.x86_64/6.6 glibc-devel.x86_64 2.12-1.149.el6 @anaconda-CentOS-201410241409.x86_64/6.6 glibc-headers.x86_64 2.12-1.149.el6 @anaconda-CentOS-201410241409.x86_64/6.6 可安裝的軟件包 glibc.i686 2.12-1.149.el6 base glibc-devel.i686 2.12-1.149.el6 base glibc-static.i686 2.12-1.149.el6 base glibc-static.x86_64 2.12-1.149.el6 base glibc-utils.x86_64 2.12-1.149.el6 base

那么問題來了,既然已經安裝了libc.so.6,為什么還是提示缺少該庫呢?繼續找啊找,百度搜索基本上無果,只能寄希望於谷歌。終於,搞定科學上網,谷歌能上了,繼續搜索,重點關注英文結果。最后,總算在Stack Overflow上找到了類似的問題與解答,點擊這里查看原文。這里只摘錄關鍵的幾句話:

In Red Hat Enterprise Linux 5, if a package was available for both the main and the compatibility architectures, both architectures of the package were installed by default.
In Red Hat Enterprise Linux 6, only the package for the primary architecture is installed by default.
To avoid problems during the backup-archive client and API installation on a 64-bit machine, be sure to install libstdc++ and compat-libstdc++.

大意是說,從Red Hat Enterprise Linux 6開始,默認只安裝主架構所需要的包,而不安裝兼容架構的包,也就是說,64位系統默認只安裝64位的軟件包。為避免這種問題,在64位系統中,要同時安裝64位的包和32位的兼容包。CentOS和從Red Hat Enterprise Linux 6的關系就不用我說了,因此我感覺這個回答比較靠譜,趕緊試試吧。

[root@cSlave00 RPM]# yum install glibc.i686 已加載插件:fastestmirror, refresh-packagekit, security 設置安裝進程 ...... 已安裝: glibc.i686 0:2.12-1.149.el6 作為依賴被安裝: nss-softokn-freebl.i686 0:3.14.3-18.el6_6 作為依賴被升級: nss-softokn-freebl.x86_64 0:3.14.3-18.el6_6 完畢! [root@cSlave00 RPM]# rpm -ivh cndrvcups-common-2.60-1.x86_64.rpm error: Failed dependencies: libstdc++.so.6 is needed by cndrvcups-common-2.60-1.x86_64 libstdc++.so.6(CXXABI_1.3) is needed by cndrvcups-common-2.60-1.x86_64

結果令人滿意,果然不再提示libc.so.6了。繼續解決libstdc++.so.6

[root@cSlave00 RPM]# yum list libstdc++* 已加載插件:fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * base: ftp.sjtu.edu.cn * extras: mirrors.163.com * updates: ftp.sjtu.edu.cn 已安裝的軟件包 libstdc++.x86_64 4.4.7-11.el6 @anaconda-CentOS-201410241409.x86_64/6.6 可安裝的軟件包 libstdc++.i686 4.4.7-11.el6 base libstdc++-devel.i686 4.4.7-11.el6 base libstdc++-devel.x86_64 4.4.7-11.el6 base libstdc++-docs.x86_64 4.4.7-11.el6 base [root@cSlave00 RPM]# yum install libstdc++.i686 已加載插件:fastestmirror, refresh-packagekit, security 設置安裝進程 ...... 已安裝: libstdc++.i686 0:4.4.7-11.el6 作為依賴被安裝: libgcc.i686 0:4.4.7-11.el6 完畢! [root@cSlave00 RPM]# rpm -ivh cndrvcups-common-2.60-1.x86_64.rpm Preparing... ########################################### [100%] 1:cndrvcups-common ########################################### [100%]

至此,終於解決了依賴問題,cndrvcups-common-2.60-1.x86_64.rpm終於安裝成功。用同樣的方法,也順利地把cndrvcups-capt-2.60-1.x86_64.rpm安裝成功。

總結:在安裝rpm包的時候,如果出現類似libc.so.6 is needed by XXX的依賴問題,首先檢查一下本機是否安裝了相應的依賴庫;如果本機確實已經安裝了所需的依賴庫而問題依舊,那就試試把相應的兼容包安裝一下,問題應該就能迎刃而解了!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM