centos7默认的gcc版本是4.8.5,无法编译高版本的glibc 2.28,需要升级到gcc 8.2版本

注:gcc高版本和glibc 2.28不兼容

## 查看自带默认的glibc
strings /lib64/lib.so.6 | grep GLIBC # 查看glibc 软件版本号
rpm -qa | grep glibc

升级gcc

升级glibc

1. 安装glibc

wget https://ftp.gnu.org/gnu/glibc/glibc-2.27.tar.gz
tar -xvf glibc-2.27.tar.gz ## 编译安装
# 进入glibc-2.27目录中
cd glibc-2.27
# 创建build目录
mkdir build
# 进入build目录
cd build
# 执行./configure
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
# 安装
make && make install ## 查看共享库
ls -l /lib64/libc.so.6 ## 再次查看系统中可使用的glibc版本
strings /lib64/libc.so.6 |grep GLIBC_

执行./confiure报错:These critical programs are missing or too old: bison compiler

安装bisonyum install bison

继续执行./configure还是报错:These critical programs are missing or too old: compiler

gcc编译器版本过低

2. 升级太高升到gcc-11.2.0去了。。

CentOS7 编译安装 gcc11.2

gcc11.2版本太高,无法编译glibc2.28(),重新安装gcc8.2

3. 安装gcc-8.2.0依赖环境

yum install bison -y
yum -y install wget bzip2 gcc gcc-c++ glib-headers

4. 升级GNU make到make 4.2

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=/usr/local/make && make && make install
export PATH=/usr/local/make/bin:$PATH
ln -s /usr/local/make/bin/make /usr/local/make/bin/gmake
make -v # 昨天使用这段命令安装的
wget http://ftp.gnu.org/gnu/make/make-4.2.tar.gz
tar -xzvf make-4.2.tar.gz
cd make-4.2
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/bin/make
sudo cp ./make /usr/bin/
make -v

5. 安装Python3.8

wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
xz -d Python-3.8.0.tar.xz
tar xf Python-3.8.0.tar
cd Python-3.8.0
./configure --prefix=/usr/local/python3
make -j 2 && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
  • 安装python3 make时报错Failed to build these modules: _ctypes

    yum install -y libffi-devel

  • 错误提示:Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_P

    安装libressl

    # 下载源码包
    wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.0.2.tar.gz
    # 解压
    tar -zxvf libressl-3.0.2.tar.gz
    # 配置安装路径
    mkdir /usr/local/libressl
    cd libressl-3.0.2
    ./configure --prefix=/usr/local/libressl
    # 安装
    make
    make install
    # 创建软连接代替openssl
    mv /usr/bin/openssl /usr/bin/openssl.bak
    mv /usr/include/openssl /usr/include/openssl.bak
    ln -s /usr/local/libressl/bin/openssl /usr/bin/openssl
    ln -s /usr/local/libressl/include/openssl /usr/include/openssl
    echo /usr/local/libressl/lib >> /etc/ld.so.conf.d/libressl-3.0.2.conf
    ldconfig -v
    # 验证是否安装完成
    openssl version
    • 错误提示:echo权限不够

      # 要给echo整条命令加单引号
      sudo sh -c 'echo /usr/local/libressl/lib >> /etc/ld.so.conf.d/libressl-3.0.2.conf'
  • 错误提示:zlib not available

    # 安装依赖
    sudo yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel

6. 安装gcc8.2.0

# 下载并解压
wdget https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-8.2.0/gcc-8.2.0.tar.gz
tar xf gcc-8.2.0.tar.gz
cd gcc-8.2.0
# 下载gmp mpfr mpc等供编译需求的依赖项
./contrib/download_prerequisites
# 配置
mkdir build
cd build
../configure --prefix=/usr/local/gcc-8.2.0 --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib
# 编译安装
make -j 2
make install
# 修改环境变量,使得gcc-8.2.0为默认的gcc
vi /etc/profile.d/gcc.sh
# 导出头文件
[yy@localhost profile.d]$ sudo ln -sv /usr/local/gcc-8.2.0/include/ /usr/include/gcc
"/usr/include/gcc/include" -> "/usr/local/gcc-8.2.0/include/"

7. 由于之前安装了gcc11.2需要做一下修改

# 应用环境变量
echo -e '\nexport PATH=/usr/local/gcc-8.2.0/bin:$PATH\n' >> /etc/profile.d/gcc.sh
source /etc/profile.d/gcc.sh # 删除库文件
sudo rm /etc/ld.so.conf.d/gcc.conf
# 设置库文件
touch /etc/ld.so.conf.d/gcc.conf
chmod 777 /etc/ld.so.conf.d/gcc.conf
echo -e "/usr/local/gcc-8.2.0/lib64" >> /etc/ld.so.conf.d/gcc.conf
# 加载动态连接库
ldconfig -v
# 查看gcc
ldconfig -p |grep gcc # 重启服务器
reboot

8. 配置glibc2.28还是报错compiler

# 尝试昨天失败的命令
sudo sh -c 'echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile‘

../configure命令成功

9. 编译

sudo make
sudo make install

make install的报错

可以不用管

10. 验证是否成功

[yy@localhost build]$ strings /usr/local/gcc-8.2.0/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_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
... [yy@localhost build]$ 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
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_2.16
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_PRIVATE
... [yy@localhost build]$ ldd --version
ldd (GNU libc) 2.28
Copyright (C) 2018 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.
Written by Roland McGrath and Ulrich Drepper.

centos7安装glibc_2.28和gcc 8.2的更多相关文章

  1. centos7 安装mysql--python模块出现EnvironmentError: mysql_config not found和error: command 'gcc' failed with exit status 1

    要想使python可以操作mysql 就需要MySQL-python驱动,它是python 操作mysql必不可少的模块. 下载地址:https://pypi.python.org/pypi/MySQ ...

  2. CentOS7安装高版本gcc

    CentOS7安装高版本gcc 下载 从hust镜像站下载gcc源码包. http://mirror.hust.edu.cn/gnu/gcc/ 我选择的是gcc-8.3.0.tar.gz. cd mk ...

  3. CentOS7安装配置Bacula yum方法

    参考: https://www.baidu.com/link?url=o2QIy2YZWjsJPAFJuYFhrH3nPvtyRkSe-o5Q_FqFZ5E1EMOsIOmGeKm0HAonwHOw8 ...

  4. Centos7安装配置ansible运维自动化工具

    准备至少两台机器 Centos7,这两台机器都关闭 selinux IP:106.13.118.132 服务端(ansible) masterIP:148.70.60.244 节点 slaver 服务 ...

  5. CentOS7安装Apache2.4+PHP5.6

    linux系统CentOS7 先下载Apache需要依赖的软件 1.APR 下载地址http://apr.apache.org/download.cgi wget下载路径http://mirror.b ...

  6. centos7安装mysql

    centos7安装mysql 1 查找系统是否安装了myql rpm -q mysql mysql-server1.1如果安装了.就删除 sudo yum -y remove mysql mysql- ...

  7. centos7安装redis3.0和phpredis扩展详细教程(图文)

    整理一下centos7安装redis3.0和phpredis扩展的过程,有需要的朋友可以拿去使用. 一.安装redis3.0 1.安装必要的包 yum install gcc 2.centos7安装r ...

  8. Centos7 安装python3

    Centos7 安装python3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #安装sqlite-devel yum -y ...

  9. CentOS7安装MySQL8.0图文教程

    1.下载 MySQL 所需要的安装包 网址:https://dev.mysql.com/downloads/mysql/ 2.Select Operating System: 选择 Red Hat , ...

  10. Centos7 安装 python2.7

    Centos7 安装 python 2.7.15 和 pip  1.先安装 GCC 包,如果没安装 GCC包 就输入以下命令行安装: (*注:以下记得使用 su 权限) yum install gcc ...

随机推荐

  1. 【技术实战】Vue技术实战【二】

    需求实战一 效果展示 代码展示 <template> <div> <a-table :dataSource="dataSource" :columns ...

  2. quarkus实战之五:细说maven插件

    quarkus的maven插件非常重要,管理和构建工程时都离不开,本篇就来一起了解和掌握它 欢迎访问我的GitHub 这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com ...

  3. python移动文件

    #移动文件(目录) shutil.move("oldpos","newpos") shutil.move("D:/知乎日报/latest/一张优惠券, ...

  4. 在不修改代码情况下解决 Chrome 浏览器跨域

    前言: 在前后台分离的项目,跨域是经常遇到的问题了.是实际解决方案中,大部分采用服务端配置,而如果只是调试,可以通过配置 Chrome 浏览器实现跨域,以下以 NodeJs 服务为例. 开始: 1. ...

  5. JS优化技巧,解决冗余代码

    1. 使用箭头函数简化函数定义 // 传统函数定义 function add(a, b) { return a + b; } // 箭头函数简化 const add = (a, b) => a ...

  6. 多层前馈神经网络及BP算法

    一.多层前馈神经网络 首先说下多层前馈神经网络,BP算法,BP神经网络之间的关系.多层前馈[multilayer feed-forward]神经网络由一个输入层.一个或多个隐藏层和一个输出层组成,后向 ...

  7. CodeForces 1332D Walk on Matrix

    题意 \(Bob\)想解决一个问题:一个\(n\cdot m\)的矩阵,从\((1,1)\)出发,只能走右和下,问从\((1,1)\)到\((n,m)\)的最大\(\&\)和 他的算法如下(\ ...

  8. 【matplotlib基础】--坐标轴

    Matplotlib的坐标轴是用于在绘图中表示数据的位置的工具. 坐标轴是图像中的水平和垂直线,它们通常表示为 x 轴和 y 轴.坐标轴的作用是帮助观察者了解图像中数据的位置和大小,通常标有数字或标签 ...

  9. 如何对MongoDB进行测试

    一.环境搭建 关于环境搭建,最好的搭建方式,当然是脚本一键式搭建 我这里是centos6 x64版本的linux上进行构建,这个linux版本现在应该是大部分的主流服务器的标配版本 下面是安装脚本的编 ...

  10. redhat7 team bonding 双网卡绑定 主备 负载均衡

    team简介 team也被称为网络组,是将多个网卡聚合在一起,从而实现冗错和提高吞吐量.适用于redhat7.0以上版本,至多可支持8块网卡.team相对于之前的bonding技术,能提供更好的性能和 ...