CentOS 7.6 编译安装最新版本glibc2.30 实录

简介: 基于CentOS上安装ScyllaDB数据库的朋友应该都会遇到glibc必须为2.28及以上版本的问题,哈目前阿里去上提供的最高版本CentOS7.6中的glibc版本为2.27,所以必须要升级,但升级glibc并不是一件容易的事,如果操作不当还会影响一些API和服务的正常运行,所以在升级之前请先做好备份。

基于CentOS上安装ScyllaDB数据库的朋友应该都会遇到glibc必须为2.28及以上版本的问题,哈目前阿里去上提供的最高版本CentOS7.6中的glibc版本为2.27,所以必须要升级,但升级glibc并不是一件容易的事,如果操作不当还会影响一些API和服务的正常运行,所以在升级之前请先做好备份。

  升级前的准备工作:
  1、升级gcc到9.2.0(请参考我的另一遍博文[https://yq.aliyun.com/articles/718551?spm=a2c4e.11155435.0.0.47163312EbbvoU](《》))
  2、安装Python3.8.0
  3、升级GNU Make 3.82到4.2.1
     wget http://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz
     tar -zxvf make-4.2.1.tar.gz
     cd make-4.2.1
     mkdir build
     cd build
     ../configure --prefix=/opt/make && make && make install
     export PATH=/opt/make/bin:$PATh
     ln -s /opt/make/bin/make /opt/make/bin/gmake
     make -v

root@xxx-xxxx ~ # cat /etc/redhat-release    # 查看当前linux版本信息
CentOS Linux release 7.6.1810 (Core) 

root@xxx-xxxx ~ # strings /lib64/libc.so.6 | grep GLIBC
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
......
......
posix_spawnp@GLIBC_2.2.5
getrpcent_r@@GLIBC_2.2.5
getprotobynumber_r@@GLIBC_2.2.5
_IO_file_close_it@@GLIBC_2.2.5
_obstack@GLIBC_2.2.5

root@xxx-xxxx ~ #  wget -c -P /opt/tmp/ http://ftp.gnu.org/gnu/glibc/glibc-2.30.tar.gz
--2019-09-18 11:39:49--  http://ftp.gnu.org/gnu/glibc/glibc-2.30.tar.gz
正在解析主机 ftp.gnu.org (ftp.gnu.org)... 209.51.188.20, 2001:470:142:3::b
正在连接 ftp.gnu.org (ftp.gnu.org)|209.51.188.20|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:32664968 (31M) [application/x-gzip]
正在保存至: “glibc-2.30.tar.gz”

100%[===========================================================================>] 32,664,968   116KB/s 用时 19m 34s

2019-09-18 11:59:24 (27.2 KB/s) - 已保存 “glibc-2.30.tar.gz” [32664968/32664968])

root@xxx-xxxx ~ # cd /opt/tmp/
root@xxx-xxxx /opt/tmp # tar -zxvf glibc-2.30.tar.gz    # 解压缩源码包
glibc-2.30/
glibc-2.30/.gitattributes
glibc-2.30/.gitignore
glibc-2.30/COPYING
glibc-2.30/COPYING.LIB
glibc-2.30/ChangeLog
glibc-2.30/ChangeLog.old/
glibc-2.30/ChangeLog.old/ChangeLog.1
glibc-2.30/ChangeLog.old/ChangeLog.10
glibc-2.30/ChangeLog.old/ChangeLog.11
......
......
glibc-2.30/wctype/wcfuncs_l.c
glibc-2.30/wctype/wchar-lookup.h
glibc-2.30/wctype/wctrans.c
glibc-2.30/wctype/wctrans_l.c
glibc-2.30/wctype/wctype.c
glibc-2.30/wctype/wctype.h
glibc-2.30/wctype/wctype_l.c

root@xxx-xxxx /opt/tmp # cd glibc-2.30
root@xxx-xxxx /opt/tmp/glibc-2.30 # mkdir build
root@xxx-xxxx /opt/tmp/glibc-2.30 # cd build
root@xxx-xxxx /opt/tmp/glibc-2.30/build # ../configure  --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for readelf... readelf
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ can link programs... yes
checking for sysdeps preconfigure fragments... aarch64 alpha arm csky hppa i386 m68k microblaze mips nios2 powerpc riscv s390 sh sparc x86_64 checking whether gcc compiles in -mx32 mode by default... no

checking for use of fpu sysdeps directories... yes
checking for -fstack-protector... yes
checking for -fstack-protector-strong... yes
checking for -fstack-protector-all... yes
checking for assembler and linker STT_GNU_IFUNC support... yes
checking for gcc attribute ifunc support... yes
checking whether the linker supports textrels along with ifunc... yes
checking if compiler warns about alias for function with incompatible types... yes
checking sysdep dirs... sysdeps/unix/sysv/linux/x86_64/64 sysdeps/unix/sysv/linux/x86_64 sysdeps/unix/sysv/linux/x86 sysdeps/x86/nptl sysdeps/unix/sysv/linux/wordsize-64 sysdeps/x86_64/nptl sysdeps/unix/sysv/linux sysdeps/nptl sysdeps/pthread sysdeps/gnu sysdeps/unix/inet sysdeps/unix/sysv sysdeps/unix/x86_64 sysdeps/unix sysdeps/posix sysdeps/x86_64/64 sysdeps/x86_64/fpu/multiarch sysdeps/x86_64/fpu sysdeps/x86/fpu sysdeps/x86_64/multiarch sysdeps/x86_64 sysdeps/x86 sysdeps/ieee754/float128 sysdeps/ieee754/ldbl-96 sysdeps/ieee754/dbl-64/wordsize-64 sysdeps/ieee754/dbl-64 sysdeps/ieee754/flt-32 sysdeps/wordsize-64 sysdeps/ieee754 sysdeps/generic
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln -s works... yes
checking whether /usr/bin/as is GNU as... yes
checking whether /usr/bin/ld is GNU ld... yes
checking for /usr/bin/as... /usr/bin/as
checking version of /usr/bin/as... 2.27, ok
checking for /usr/bin/ld... /usr/bin/ld
checking version of /usr/bin/ld... 2.27, ok
checking for gnumake... no
checking for gmake... gmake
checking version of gmake... 4.2.1, ok
checking for gnumsgfmt... no
checking for gmsgfmt... no
checking for msgfmt... msgfmt
checking version of msgfmt... 0.19.8.1, ok
checking for makeinfo... makeinfo
checking version of makeinfo... 5.1, ok
checking for sed... sed
checking version of sed... 4.2.2, ok
checking for gawk... gawk
checking version of gawk... 4.0.2, ok
checking for bison... bison
checking version of bison... 3.0.4, ok
checking if gcc -B/usr/bin/ is sufficient to build libc... yes
checking for nm... nm
checking for python3... python3
checking version of python3... 3.8.0, ok
checking LD_LIBRARY_PATH variable... ok
checking for bash... /usr/bin/bash
checking for perl... /usr/bin/perl
checking for install-info... /usr/sbin/install-info
checking for .set assembler directive... yes
checking linker support for protected data symbol... yes
checking linker support for INSERT in linker script... yes
checking for broken __attribute__((alias()))... no
checking whether to put _rtld_local into .sdata section... no
checking whether to use .ctors/.dtors header and trailer... no
checking for libunwind-support in compiler... no
checking whether --noexecstack is desirable for .S files... yes
checking for -z combreloc... yes
checking for linker that supports -z execstack... yes
checking for linker that supports --no-dynamic-linker... yes
checking for -static-pie... yes
checking for -fpie... yes
checking for --hash-style option... yes
checking for sufficient default -shared layout... no
checking for GLOB_DAT reloc... yes
checking linker output format... elf64-x86-64
checking for -fno-toplevel-reorder -fno-section-anchors... yes
checking for -mtls-dialect=gnu2... yes
checking whether cc puts quotes around section names... no
checking for __builtin_memset... yes
checking for redirection of built-in functions... yes
checking for compiler option to disable generation of FMA instructions... -ffp-contract=off
checking if gcc -B/usr/bin/ accepts -fno-tree-loop-distribute-patterns with __attribute__ ((__optimize__))... yes
checking for libgd... no
checking for is_selinux_enabled in -lselinux... yes
checking for audit_log_user_avc_message in -laudit... no
checking for cap_init in -lcap... no
checking for _FORTIFY_SOURCE predefine... no
checking whether the linker provides working __ehdr_start... yes
checking for __builtin_trap with no external dependencies... yes
checking whether the C++ compiler supports thread_local... no
running configure fragment for sysdeps/unix/sysv/linux/x86_64/64
running configure fragment for sysdeps/unix/sysv/linux/x86_64
running configure fragment for sysdeps/unix/sysv/linux
checking installed Linux kernel header files... 3.2.0 or later
checking for kernel header at least 3.2.0... ok
checking for symlinks in /usr/include... ok
running configure fragment for sysdeps/gnu
running configure fragment for sysdeps/x86_64
checking for AVX512DQ support in assembler... yes
checking for AVX512 support... yes
checking -mprefer-vector-width=128... yes
checking for Intel MPX support... yes
running configure fragment for sysdeps/x86
checking whether -fPIC is default... no
checking whether -fPIE is default... no
configure: creating ./config.status
config.status: creating config.make
config.status: creating Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing default commands
# 如果支行没有错误会生成makefile,如果有错按照错误提示解决,一般都是一些依赖项目的版本不正确升级一下即可

root@xxx-xxxx /opt/tmp/glibc-2.30/build # make
make -r PARALLELMFLAGS="" -C .. objdir=`pwd` all
make[1]: Entering directory '/opt/tmp/glibc-2.30'
......
......
make[2]: Leaving directory '/opt/tmp/glibc-2.30/elf'
make[1]: Leaving directory '/opt/tmp/glibc-2.30'    # 编译成功

root@xxx-xxxx /opt/tmp/glibc-2.30/build # make install
LC_ALL=C; export LC_ALL; \
make -r PARALLELMFLAGS="" -C .. objdir=`pwd` install
make[1]: Entering directory '/opt/tmp/glibc-2.30'
make  subdir=csu -C csu ..=../ subdir_lib
make  subdir=iconv -C iconv ..=../ subdir_lib
......
......
LD_SO=ld-linux-x86-64.so.2 CC="gcc -B/usr/bin/" /usr/bin/perl scripts/test-installation.pl /opt/tmp/glibc-2.30/build/
/usr/bin/ld: cannot find -lnss_test2
collect2: error: ld returned 1 exit status   # 此编译错误可以无视
Execution of gcc -B/usr/bin/ failed!         # 此编译错误可以无视
The script has found some problems with your installation!
Please read the FAQ and the README file and check the following:
- Did you change the gcc specs file (necessary after upgrading from
  Linux libc5)?
- Are there any symbolic links of the form libXXX.so to old libraries?
  Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,
  libm.so should point to the newly installed glibc file - and there should be
  only one such link (check e.g. /lib and /usr/lib)
You should restart this script from your build directory after you've
fixed all problems!
Btw. the script doesn't work if you're installing GNU libc not as your
primary library!
make[1]: *** [Makefile:111: install] Error 1
make[1]: Leaving directory '/opt/tmp/glibc-2.30'
make: *** [Makefile:12: install] Error 2    # 此编译错误可以无视

root@xxx-xxxx /opt/tmp/glibc-2.30/build # ls -l /lib64/libc.so.6    # 检验是否成功
lrwxrwxrwx 1 root root 12 Sep 18 15:14 /lib64/libc.so.6 -> libc-2.30.so    # 表示安装成功

root@xxx-xxxx ~ #

以上内容来自我的CSDN博文:https://blog.csdn.net/RyanFang/article/details/100984938

相关文章
|
3月前
|
Linux 数据库管理 Python
CentOS7编译安装Python3.10(含OpenSSL1.1.1安装),创建虚拟环境,运行Django项目(含sqlite版本报错)
CentOS7编译安装Python3.10(含OpenSSL1.1.1安装),创建虚拟环境,运行Django项目(含sqlite版本报错)
509 4
|
21天前
|
消息中间件 Linux API
centos7 安装rabbitmq自定义版本及配置
centos7 安装rabbitmq自定义版本及配置
|
21天前
|
Linux 开发工具 C语言
centos7编译安装python3
centos7编译安装python3
|
21天前
|
分布式计算 Java Hadoop
centos7编译安装Hadoop3
centos7编译安装Hadoop3
|
24天前
|
Linux PHP
Linux CentOS 宝塔 Suhosin禁用php5.6版本eval函数详细图文教程
【8月更文挑战第27天】本文介绍两种禁用PHP执行的方法:使用`PHP_diseval_extension`禁用和通过`suhosin`禁用。由于`suhosin`不支持PHP8,仅适用于PHP7及以下版本,若服务器安装了PHP5.6,则需对应安装`suhosin-0.9.38`版本。文章提供了详细的安装步骤,并强调了宝塔环境下与普通环境下的PHP路径差异。安装完成后,在`php.ini`中添加`suhosin.so`扩展并设置`executor.disable_eval = on`以禁用执行功能。最后通过测试代码验证是否成功禁用,并重启`php-fpm`服务生效。
18 2
|
1月前
|
关系型数据库 MySQL Linux
【一键解锁神秘力量!】CentOS 7 通过编译源码方式安装 MySQL 数据库 —— 从零到英雄的数据库安装实战秘籍!
【8月更文挑战第9天】随着业务增长,对数据库的需求日益提高。在 CentOS 7 中,通过编译源码安装 MySQL 可提供更高定制性和灵活性。本文详细介绍从准备环境、下载源码、配置编译参数到安装 MySQL 的全过程,并对比 RPM 包安装方法,帮助读者根据需求选择合适方案。实践时需注意备份数据、选择合适版本、确保安全性和调优性能等要点。
117 1
|
2月前
|
消息中间件 Linux 数据库
OpenStack Centos7 T版本搭建
OpenStack Centos7 T版本搭建
83 15
|
3月前
|
Linux
通过ELRepo修改CentOS 7内核版本的详细步骤
通过ELRepo修改CentOS 7内核版本的详细步骤
396 3
|
3月前
|
Linux vr&ar C语言
Linux怎样更新Centos下Gcc版本支持C17?Centos7快速安装gcc8.3.1 可支持C++17(附gcc相关链接整理)
Linux怎样更新Centos下Gcc版本支持C17?Centos7快速安装gcc8.3.1 可支持C++17(附gcc相关链接整理)
197 2
|
3月前
|
Linux C语言 C++
Linux 下centos 查看 -std这个编译时命令 是否支持 C17
Linux 下centos 查看 -std这个编译时命令 是否支持 C17
95 2