升级glibc、gcc、zlib等

前言:昨天公司先上线一个项目,需要用到Libreoffice开源办公套件,版本为最新版6.2的。这就难为我老人家,没办法,干吧。

成功的路上总是不那么一番风顺,总会有点小瑕疵,才会让人铭记于心。

先介绍环境:

[root@xh-php-01t ~]# cat /etc/redhat-release 
CentOS release 6.10 (Final)
[root@xh-php-01t ~]# uname -r
2.6.32-754.el6.x86_64
[root@xh-php-01t ~]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

第一个问题:

[root@xh-php-01t ~]# libreoffice6.2 
/opt/libreoffice6.2/program/oosplash: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/libreoffice6.2/program/oosplash)
/opt/libreoffice6.2/program/oosplash: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/libreoffice6.2/program/libuno_sal.so.3)

解决方法:

查看libc.so.6模块支持的gblic版本,strings 命令简单来说就是打印出该模块的所有能打印的信息

[root@test ~]# strings /lib64/libc.so.6|grep GLIB
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_PRIVATE

可以发现centos6.10的glibc所有支持的版本

查看glibc的版本

[root@test ~]# rpm -aq|grep glibc
glibc-common-2.12-1.212.el6.x86_64
glibc-2.12-1.212.el6.x86_64

升级glibc到2.15以上

升级步骤:下载glibc2.15的rpm包(我们不准自己编译),上传到服务器,yum 安装

[root@test ~]# ll glibc2.15.zip 
-rw-r--r--. 1 root root 20975068 Apr 18  2019 glibc2.15.zip
[root@test ~]# yum install unzip
[root@test ~]# unzip glibc2.15.zip 
Archive:  glibc2.15.zip
  inflating: glibc2.15/glibc-2.15-60.el6.x86_64.rpm  
  inflating: glibc2.15/glibc-common-2.15-60.el6.x86_64.rpm  
  inflating: glibc2.15/glibc-devel-2.15-60.el6.x86_64.rpm  
  inflating: glibc2.15/glibc-headers-2.15-60.el6.x86_64.rpm  
  inflating: glibc2.15/glibc-static-2.15-60.el6.x86_64.rpm  
  inflating: glibc2.15/glibc-utils-2.15-60.el6.x86_64.rpm  
[root@test ~]# cd glibc2.15
[root@test glibc2.15]# yum install ./*.rpm

升级之后:第一个问题解决

[root@test glibc2.15]# rpm -aq|grep glibc
glibc-2.15-60.el6.x86_64
glibc-headers-2.15-60.el6.x86_64
glibc-static-2.15-60.el6.x86_64
glibc-common-2.15-60.el6.x86_64
glibc-devel-2.15-60.el6.x86_64
glibc-utils-2.15-60.el6.x86_64
[root@test glibc2.15]# strings /lib64/libc.so.6|grep GLIB 
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_PRIVATE

第二个问题:

[root@test glibc2.15]# libreoffice6.2                    
/opt/libreoffice6.2/program/oosplash: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /opt/libreoffice6.2/program/libuno_sal.so.3)

解决方法:

查看libstdc++.so.6模块支持的gcc版本,strings 命令简单来说就是打印出该模块的所有能打印的信息

[root@test glibc2.15]# strings /usr/lib64/libstdc++.so.6|grep GLIBCXX
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH
现在要做的就是找到libstdc++.so.6这个模块是谁提供的,我摸索出来了,你们就不用找了,安装gcc会自动依赖安装libstdc++,而这个模块就是libstdc++包提供的

说明一点:libstdc++.so.6模块是libstdc++包提供的,但是它依赖gcc包

当然包我已经下好了,后面会附上链接。

[root@test ~]# ll gcc4.8.2.zip 
-rw-r--r--. 1 root root 33789418 Apr 17  2019 gcc4.8.2.zip
[root@test ~]# unzip gcc4.8.2.zip 
Archive:  gcc4.8.2.zip
   creating: gcc4.8.2/
  inflating: gcc4.8.2/cpp-4.8.2-8.el6.x86_64.rpm  
  inflating: gcc4.8.2/gcc-4.8.2-8.el6.x86_64.rpm  
  inflating: gcc4.8.2/gcc-c++-4.8.2-8.el6.x86_64.rpm  
  inflating: gcc4.8.2/libgcc-4.8.2-8.el6.x86_64.rpm  
  inflating: gcc4.8.2/libgomp-4.8.2-8.el6.x86_64.rpm  
  inflating: gcc4.8.2/libmpc-0.8.3-0.3.svn855.el6.x86_64.rpm  
  inflating: gcc4.8.2/libstdc++-4.8.2-8.el6.x86_64.rpm  
  inflating: gcc4.8.2/libstdc++-devel-4.8.2-8.el6.x86_64.rpm  
  inflating: gcc4.8.2/libtool-2.4.2-21.el6.x86_64.rpm
[root@test ~]# cd gcc4.8.2    
[root@test gcc4.8.2]# yum install ./*.rpm

[root@test gcc4.8.2]# gcc --version
gcc (GCC) 4.8.2 20131212 (Red Hat 4.8.2-8)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

第三个问题:

[root@test gcc4.8.2]# libreoffice6.2                    
/opt/libreoffice6.2/program/oosplash: /lib64/libz.so.1: version `ZLIB_1.2.3.4' not found (required by /opt/libreoffice6.2/program/oosplash)

 解决方法:centos6.10的zlib版本是1.2.3,这个软件需要的版本比他高,所以我们要升级zlib

[root@test ~]# wget http://www.zlib.net/fossils/zlib-1.2.5.tar.gz
[root@test ~]# ll zlib-1.2.5.tar.gz 
-rw-r--r--. 1 root root 544640 Apr 19  2019 zlib-1.2.5.tar.gz
[root@test ~]# tar xf zlib-1.2.5.tar.gz 
[root@test ~]# cd zlib-1.2.5   
[root@test zlib-1.2.5]# ./configure --prefix=/usr/local/zlib1.2.5
[root@test zlib-1.2.5]# make && make install
把新编译的模块加载到模块库中
[root@test zlib-1.2.5]# echo /usr/local/zlib1.2.5/lib/ >>/etc/ld.so.conf
[root@test zlib-1.2.5]# ldconfig -v 

第四个问题:

[root@test ~]# libreoffice6.2 --version
/opt/libreoffice6.2/program/soffice.bin: error while loading shared libraries: libcairo.so.2: cannot open shared object file: No such file or directory

解决方法:报错提示说libcairo.so.2没发现,但是/opt/libreoffice6.2/program/soffice.bin程序需要使用它,那我们来看看这个程序运行所需的依赖库还有那些,我们及时i补充它,这里用到ldd命令

[root@test ~]# ldd /opt/libreoffice6.2/program/soffice.bin
/opt/libreoffice6.2/program/soffice.bin: /lib64/libdbus-1.so.3: no version information available (required by /opt/libreoffice6.2/program/libmergedlo.so)
/opt/libreoffice6.2/program/soffice.bin: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/libreoffice6.2/program/libnspr4.so)
/opt/libreoffice6.2/program/soffice.bin: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/libreoffice6.2/program/libcurl.so.4)
/opt/libreoffice6.2/program/soffice.bin: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/libreoffice6.2/program/libxslt.so.1)
/opt/libreoffice6.2/program/soffice.bin: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/libreoffice6.2/program/liblangtag-lo.so.1)
        linux-vdso.so.1 =>  (0x00007ffd39dba000)
        libmergedlo.so => /opt/libreoffice6.2/program/libmergedlo.so (0x00007f50f26ca000)
        libuno_sal.so.3 => /opt/libreoffice6.2/program/libuno_sal.so.3 (0x00007f50f2465000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f50f20a4000)
        libgpgmepp.so.6 => /opt/libreoffice6.2/program/libgpgmepp.so.6 (0x00007f50f1e48000)
        libicuuc.so.63 => /opt/libreoffice6.2/program/libicuuc.so.63 (0x00007f50f1a7a000)
        libz.so.1 => /usr/local/zlib1.2.5/lib/libz.so.1 (0x00007f50f185e000)
        libplc4.so => /opt/libreoffice6.2/program/libplc4.so (0x00007f50f1659000)
        libnspr4.so => /opt/libreoffice6.2/program/libnspr4.so (0x00007f50f141b000)
        libnss3.so => /opt/libreoffice6.2/program/libnss3.so (0x00007f50f10f9000)
        libsmime3.so => /opt/libreoffice6.2/program/libsmime3.so (0x00007f50f0ed2000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f50f0ccd000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f50f0ab1000)
        libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x00007f50f0870000)
        libicui18n.so.63 => /opt/libreoffice6.2/program/libicui18n.so.63 (0x00007f50f03a2000)
        libcurl.so.4 => /opt/libreoffice6.2/program/libcurl.so.4 (0x00007f50f013c000)
        libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f50efdff000)
        libxml2.so.2 => /opt/libreoffice6.2/program/libxml2.so.2 (0x00007f50efa41000)
        libxslt.so.1 => /opt/libreoffice6.2/program/libxslt.so.1 (0x00007f50ef801000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f50ef5f9000)
        liborcus-0.14.so.0 => /opt/libreoffice6.2/program/liborcus-0.14.so.0 (0x00007f50ef2b7000)
        liborcus-parser-0.14.so.0 => /opt/libreoffice6.2/program/liborcus-parser-0.14.so.0 (0x00007f50ef077000)
        libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x00007f50eed5d000)
        libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x00007f50eeb10000)
        libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f50ee7f9000)
        liblcms2.so.2 => /opt/libreoffice6.2/program/liblcms2.so.2 (0x00007f50ee5a0000)
        libcairo.so.2 => not found
        libcups.so.2 => not found
        libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00007f50ee369000)
        libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00007f50ee0cb000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f50eddd2000)
        libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f50edbc0000)
        libSM.so.6 => not found
        libICE.so.6 => not found
        libuno_cppu.so.3 => /opt/libreoffice6.2/program/libuno_cppu.so.3 (0x00007f50ed984000)
        libuno_cppuhelpergcc3.so.3 => /opt/libreoffice6.2/program/libuno_cppuhelpergcc3.so.3 (0x00007f50ed697000)
        libi18nlangtag.so => /opt/libreoffice6.2/program/libi18nlangtag.so (0x00007f50ed478000)
        libjvmaccesslo.so => /opt/libreoffice6.2/program/libjvmaccesslo.so (0x00007f50ed270000)
        libjvmfwklo.so => /opt/libreoffice6.2/program/libjvmfwklo.so (0x00007f50ed039000)
        libuno_salhelpergcc3.so.3 => /opt/libreoffice6.2/program/libuno_salhelpergcc3.so.3 (0x00007f50ece29000)
        libxmlreaderlo.so => /opt/libreoffice6.2/program/libxmlreaderlo.so (0x00007f50ecc1d000)
        libepoxy.so => /opt/libreoffice6.2/program/libepoxy.so (0x00007f50ec8e8000)
        libclewlo.so => /opt/libreoffice6.2/program/libclewlo.so (0x00007f50ec6e2000)
        libclucene.so => /opt/libreoffice6.2/program/libclucene.so (0x00007f50ec2f1000)
        libpdfiumlo.so => /opt/libreoffice6.2/program/libpdfiumlo.so (0x00007f50ebc6d000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f50eb963000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f50eb74d000)
        /lib64/ld-linux-x86-64.so.2 (0x000055a6647be000)
        libgpgme.so.11 => /opt/libreoffice6.2/program/libgpgme.so.11 (0x00007f50eb506000)
        libassuan.so.0 => /opt/libreoffice6.2/program/libassuan.so.0 (0x00007f50eb2f3000)
        libicudata.so.63 => /opt/libreoffice6.2/program/libicudata.so.63 (0x00007f50e9731000)
        libnssutil3.so => /opt/libreoffice6.2/program/libnssutil3.so (0x00007f50e9501000)
        libplds4.so => /opt/libreoffice6.2/program/libplds4.so (0x00007f50e92fc000)
        libssl3.so => /opt/libreoffice6.2/program/libssl3.so (0x00007f50e90aa000)
        libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f50e8e85000)
        libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f50e8c80000)
        libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x00007f50e8a7d000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f50e8863000)
        libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f50e8643000)
        libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f50e841b000)
        libreglo.so => /opt/libreoffice6.2/program/libreglo.so (0x00007f50e81ff000)
        libunoidllo.so => /opt/libreoffice6.2/program/libunoidllo.so (0x00007f50e7f97000)
        liblangtag-lo.so.1 => /opt/libreoffice6.2/program/liblangtag-lo.so.1 (0x00007f50e7d71000)
        libgpg-error-lo.so.0 => /opt/libreoffice6.2/program/libgpg-error-lo.so.0 (0x00007f50e7b5c000)
        libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f50e7958000)
        libstorelo.so => /opt/libreoffice6.2/program/libstorelo.so (0x00007f50e773d000)

可以看出ldd可以列出动态可执行程序所依赖的模块文件,上面可以发现该程序还有四个依赖没有找到,后面肯定会报错的,一起看。

[root@test ~]# yum install cairo 
[root@test ~]# libreoffice6.2 --version
/opt/libreoffice6.2/program/soffice.bin: error while loading shared libraries: libcups.so.2: cannot open shared object file: No such file or directory
[root@test ~]# yum install cups
[root@test ~]# libreoffice6.2 --version
/opt/libreoffice6.2/program/soffice.bin: error while loading shared libraries: libSM.so.6: cannot open shared object file: No such file or directory
[root@test ~]# yum install libSM
[root@test ~]# libreoffice6.2 --version
/opt/libreoffice6.2/program/soffice.bin: /lib64/libdbus-1.so.3: no version information available (required by /opt/libreoffice6.2/program/libmergedlo.so)
/opt/libreoffice6.2/program/soffice.bin: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/libreoffice6.2/program/libnspr4.so)
/opt/libreoffice6.2/program/soffice.bin: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/libreoffice6.2/program/libcurl.so.4)
/opt/libreoffice6.2/program/soffice.bin: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/libreoffice6.2/program/libxslt.so.1)
/opt/libreoffice6.2/program/soffice.bin: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /opt/libreoffice6.2/program/liblangtag-lo.so.1)

从上面来看,基本是解决了,但是我们升级的glibc版本还是太低了,要升级到2.17才行,方法都是一样,就不再写了。下面附上用到的包的链接:

链接:https://pan.baidu.com/s/16UAPUq21WDxk6Xuc_oy2fQ
提取码:k3rv

posted @ 2019-04-19 09:40  我是一个大胖子  阅读(4316)  评论(0编辑  收藏  举报