2022的第一个凌晨从解决BUG开始
起 因
故事是这样的:
前一天下午在华为云上的一台服务器(arm架构的CentOS7.6)上安装华为的大数据平台MRS(arm架构的EulerOS)的客户端时报错,如下:
[root@ecs-820c-temp1 mrs_client]# kinit dcf_etl_hm kinit: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by /data/mrs_client/KrbClient/kerberos/lib/libgssapi_krb5.so.2) |
根据提示来看,可能是GLIBC的版本过低,而客户端编译时用的客户端是2.27的版本。
继续确认:
[root@ecs-820c-temp1 mrs_client]# rpm -qa | grep glibc glibc-devel-2.17-292.el7.aarch64 glibc-common-2.17-292.el7.aarch64 glibc-headers-2.17-292.el7.aarch64 glibc-2.17-292.el7.aarch64 |
果然,这台服务器上是2.17,我去,差了10个迭代呀,能用才怪!
故事开头已经讲完了,接下来讲讲怎么升级这个GLIBC,又是一个升级打怪的开端……
我本想着,这2021的最后一晚总要有点不寻常的回忆吧?谁知道,果然不寻常。
陷 坑
首先想到的是去开源社区下载源码包编译,毕竟这是华为的鲲鹏服务器,不像x86有很多已经做好的rpm包。
当我下载了源码包,进行编译的时候,问题来了:
前面省略几十行……
checking for gawk... gawk checking version of gawk... 4.0.2, ok checking for bison... no checking if gcc is sufficient to build libc... no checking for nm... nm checking for python3... no checking for python... python configure: error: *** These critical programs are missing or too old: bison compiler *** Check the INSTALL file for required versions. |
这错误提示我编译器太老了,于是我看了下gcc的版本
[root@ecs-820c-temp1 glibc-build]# rpm -qa | grep gcc gcc-4.8.5-44.el7.aarch64 libgcc-4.8.5-44.el7.aarch64 gcc-c++-4.8.5-44.el7.aarch64 |
我去,这可不是一般的老啊!
首先想到的是通过yum升级,居然没有yum源有更新的版本,看来鲲鹏社区还得努力呀!
没办法,只能自己动手,暂且不说丰衣足食,至少能跑,“管它是人跑还是程序跑”。
找国外开源软件的源码包,我常去的地方一个是github(https://github.com/),一个是清华大学开源软件镜像站(https://mirrors.tuna.tsinghua.edu.cn/gnu/)。
相对而言,清华的网速对国内有好一点。
在上面我看到gcc的最新版本是2021年6月份更新的9.4.0,我还是保守一点,选择大版本最新,小版本最小的吧,也就是9.1.0。
好家伙,当我配置时,有给我来一堆的报错:
前面省略几十行……
checking for objdir... .libs checking for the correct version of gmp.h... no configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+. Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations. Source code for these libraries can be found at their respective hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/. See also http://gcc.gnu.org/install/prerequisites.html for additional info. If you obtained GMP, MPFR and/or MPC from a vendor distribution package, make sure that you have installed both the libraries and the header files. They may be located in separate packages. |
意思是这几个玩意要满足最低的版本要求:
1、GMP 4.2+
2、MPFR 2.4.0+
3、MPC 0.8.0+
爬 起
这下,彻底激起了我的斗志(愤怒)!
继续到清华的镜像站找这三个,接下来就有了下面的步骤:
安装gpm
下载安装包
[root@ecs-820c-temp1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gmp/gmp-6.1.0.tar.bz2 --no-check-certificate |
创建安装目录
[root@ecs-820c-temp1 ~]# mkdir /usr/local/gmp-6.1.0 |
解压
[root@ecs-820c-temp1 ~]# bzip2 -d gmp-6.1.0.tar.bz2 [root@ecs-820c-temp1 ~]# tar xf gmp-6.1.0.tar |
编译安装
[root@ecs-820c-temp1 ~]# cd gmp-6.1.0 [root@ecs-820c-temp1 gmp-6.1.0]# ./configure --prefix=/usr/local/gmp-6.1.0 [root@ecs-820c-temp1 gmp-6.1.0]# make [root@ecs-820c-temp1 gmp-6.1.0]# make install |
加载环境变量
[root@ecs-820c-temp1 gmp-6.1.0]# export LD_LIBRARY_PATH=/usr/local/gmp-6.1.0/lib:$LD_LIBRARY_PATH |
安装mpfr
下载安装包
[root@ecs-820c-temp1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gnu/mpfr/mpfr-3.1.4.tar.bz2 --no-check-certificate |
创建安装目录
[root@ecs-820c-temp1 ~]# mkdir /usr/local/mpfr-3.1.4 |
解压
[root@ecs-820c-temp1 ~]# bzip2 -d mpfr-3.1.4.tar.bz2 [root@ecs-820c-temp1 ~]# tar xf mpfr-3.1.4.tar |
编译安装
[root@ecs-820c-temp1 ~]# cd mpfr-3.1.4 [root@ecs-820c-temp1 mpfr-3.1.4]# ./configure --prefix=/usr/local/mpfr-3.1.4 --with-gmp-include=/usr/local/gmp-6.1.0/include --with-gmp-lib=/usr/local/gmp-6.1.0/lib [root@ecs-820c-temp1 mpfr-3.1.4]# make [root@ecs-820c-temp1 mpfr-3.1.4]# make install |
加载环境变量
[root@ecs-820c-temp1 mpfr-3.1.4]# export LD_LIBRARY_PATH=/usr/local/mpfr-3.1.4/lib:$LD_LIBRARY_PATH |
安装mpc
下载安装包
[root@ecs-820c-temp1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gnu/mpc/mpc-1.0.3.tar.gz --no-check-certificate |
创建安装目录
[root@ecs-820c-temp1 ~]# mkdir /usr/local/mpc-1.0.3 |
解压
[root@ecs-820c-temp1 ~]# tar zxf mpc-1.0.3.tar.gz |
编译安装
[root@ecs-820c-temp1 ~]# cd mpc-1.0.3 [root@ecs-820c-temp1 mpc-1.0.3]# ./configure --prefix=/usr/local/mpc-1.0.3 --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.4 [root@ecs-820c-temp1 mpc-1.0.3]# make [root@ecs-820c-temp1 mpc-1.0.3]# make install |
加载环境变量
[root@ecs-820c-temp1 mpc-1.0.3]# export LD_LIBRARY_PATH=/usr/local/mpc-1.0.3/lib:$LD_LIBRARY_PATH |
安装GNU
下载安装包
[root@ecs-820c-temp1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-9.1.0/gcc-9.1.0.tar.xz--no-check-certificate |
创建安装目录
[root@ecs-820c-temp1 ~]# mkdir /usr/local/gcc-9.1.0 |
解压
[root@ecs-820c-temp1 ~]# tar xf gcc-9.1.0.tar.xz |
编译安装
[root@ecs-820c-temp1 ~]# cd gcc-9.1.0 [root@ecs-820c-temp1 gcc-9.1.0]# mkdir obj [root@ecs-820c-temp1 gcc-9.1.0]# cd obj [root@ecs-820c-temp1 obj]# ../configure --disable-multilib --enable-languages="c,c++,fortran" --prefix=/usr/local/gcc-9.1.0 --disable-static --enable-shared --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.4 --with-mpc=/usr/local/mpc-1.0.3 [root@ecs-820c-temp1 obj]# make -j 96 [root@ecs-820c-temp1 obj]# make -j 96 install |
接下来是漫长的等待,一只羊,两只羊,三只羊… …
吃鸡(和平精英)… …
一局结束,差不多就编译完成。
加载环境变量
[root@ecs-820c-temp1 obj]# export LD_LIBRARY_PATH=/usr/local/gcc-9.1.0/lib:$LD_LIBRARY_PATH [root@ecs-820c-temp1 obj]# export PATH=/usr/local/gcc-9.1.0/bin:$PATH |
验证
[root@ecs-820c-temp1 obj]# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/local/gcc-9.1.0/libexec/gcc/aarch64-unknown-linux-gnu/9.1.0/lto-wrapper Target: aarch64-unknown-linux-gnu Configured with: ../configure --disable-multilib --enable-languages=c,c++,fortran --prefix=/usr/local/gcc-9.1.0 --disable-static --enable-shared --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.4 --with-mpc=/usr/local/mpc-1.0.3 Thread model: posix gcc version 9.1.0 (GCC) |
安装make
下载安装包
[root@ecs-820c-temp1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gnu/make/make-4.2.tar.bz2 --no-check-certificate |
创建安装目录
[root@ecs-820c-temp1 ~]# mkdir /usr/local/make-4.2 |
解压
[root@ecs-820c-temp1 ~]# bzip2 -d make-4.2.tar.bz2 [root@ecs-820c-temp1 ~]# tar xf make-4.2.tar |
编译安装
[root@ecs-820c-temp1 ~]# cd make-4.2 [root@ecs-820c-temp1 make-4.2]# mkdir build [root@ecs-820c-temp1 make-4.2]# cd build [root@ecs-820c-temp1 build]# ../configure --prefix=/usr/local/make-4.2 [root@ecs-820c-temp1 build]# make -j 96 [root@ecs-820c-temp1 build]# make install |
加载环境变量
[root@ecs-820c-temp1 build]# export PATH=/usr/local/make-4.2/bin:$PATH [root@ecs-820c-temp1 build]# export LD_LIBRARY_PATH=/usr/local/make-4.2/lib:$LD_LIBRARY_PATH |
修改软连接
[root@ecs-820c-temp1 build]# rm -rf /usr/bin/gmake [root@ecs-820c-temp1 build]# ln -s /usr/local/make-4.2/bin/make /usr/bin/gmake |
验证
[root@ecs-820c-temp1 build]# make -v GNU Make 4.2 Built for aarch64-unknown-linux-gnu Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. [root@ecs-820c-temp1 build]# gmake -v GNU Make 4.2 Built for aarch64-unknown-linux-gnu Copyright (C) 1988-2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. |
安装glibc
下载安装包
[root@ecs-820c-temp1 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gnu/glibc/glibc-2.32.tar.bz2 --no-check-certificate |
解压
[root@ecs-820c-temp1 ~]# bzip2 -d glibc-2.32.tar.bz2 [root@ecs-820c-temp1 ~]# tar xf glibc-2.32.tar |
编译安装
注意:--prefix=/usr,这个地方不能随便改,改了就不能升级了
[root@ecs-820c-temp1 ~]# cd glibc-2.32 [root@ecs-820c-temp1 glibc-2.32]# mkdir build [root@ecs-820c-temp1 glibc-2.32]# cd build/ [root@ecs-820c-temp1 build]# yum install -y python3 bison [root@ecs-820c-temp1 build]# export LD_LIBRARY_PATH=/usr/local/gmp-6.1.0/lib:/usr/local/mpfr-3.1.4/lib:/usr/local/mpc-1.0.3/lib:/usr/local/make-4.2/lib:/usr/local/gcc-9.1.0/lib [root@ecs-820c-temp1 build]# ../configure --prefix=/usr --with-gmp=/usr/local/gmp-6.1.0 --with-mpfr=/usr/local/mpfr-3.1.4 --with-mpc=/usr/local/mpc-1.0.3 --with-gcc=/usr/local/gcc-9.1.0 [root@ecs-820c-temp1 build]# make -j 96 [root@ecs-820c-temp1 build]# make -j 96 install |
加载环境变量
[root@ecs-820c-temp1 build]# export PATH=/usr/local/glibc-2.32/bin:$PATH [root@ecs-820c-temp1 build]# export LD_LIBRARY_PATH=/usr/local/glibc-2.32/lib:$LD_LIBRARY_PATH |
检查
升级前:
[root@ecs-820c-temp1 ~]# strings /usr/lib64/libc.so.6 | grep ^GLIBC GLIBC_2.17 GLIBC_2.18 GLIBC_PRIVATE |
升级后:
[root@ecs-820c-temp1 ~]# strings /usr/lib64/libc.so.6 | grep ^GLIBC GLIBC_2.17 GLIBC_2.18 GLIBC_2.22 GLIBC_2.23 GLIBC_2.24 GLIBC_2.25 GLIBC_2.26 GLIBC_2.27 GLIBC_2.28 GLIBC_2.29 GLIBC_2.30 GLIBC_2.32 GLIBC_PRIVATE GLIBC_2.29 GLIBC_2.26 GLIBC_2.25 GLIBC_2.28 GLIBC_2.23 GLIBC_2.30 |
翻 身
终于,glibc升级成功了。
此时已经是凌晨1点多,在深圳这样的一线城市,执行政令比哪里都要高效。为了落实防疫的政策,听不到跨年的倒数,也看不到辞旧的烟花。
接下来,就是见证奇迹的时候到了……
验证MRS客户端认证
加载环境变量
[root@ecs-820c-temp1 ~]# source /opt/mrs_client/bigdata_env |
认证
[root@ecs-820c-temp1 ~]# kinit dcf_user_hm Password for dcf_user_hm@HADOOP.COM: [root@ecs-820c-temp1 ~]# klist Ticket cache: FILE:/tmp//krb5cc_0 Default principal: dcf_user_hm@HADOOP.COM Valid starting Expires Service principal 01/01/22 01:54:44 01/02/22 01:54:38 krbtgt/HADOOP.COM@HADOOP.COM |
不再报错,完美!
经历了几个小时的折腾,问题总算是解决,2022来一句问候吧!
[root@ecs-820c-temp1 ~]# beeline Connected to: Apache Hive (version 3.1.0-hw-ei-310012) Driver: Hive JDBC (version 3.1.0-hw-ei-310012) Transaction isolation: TRANSACTION_REPEATABLE_READ Beeline version 3.1.0-hw-ei-310012 by Apache Hive 0: jdbc:hive2://192.168.0.51:10000/> select 'hello, 2022!'; +---------------+ | _c0 | +---------------+ | hello, 2022! | +---------------+ 1 row selected (0.29 seconds) 0: jdbc:hive2://192.168.0.51:10000/> |
- 点赞
- 收藏
- 关注作者
评论(0)