欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CentOS7 安装gcc和glibc-2.18

程序员文章站 2022-07-15 17:07:35
...

1、安装GLIBC_2.18

wget http://ftp.gnu.org/gnu/libc/glibc-2.18.tar.gz
tar xvf glibc-2.18.tar.gz
cd glibc-2.18
mkdir build
cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

 到configure这一步报错:

[[email protected] build]# ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/glibc-2.18/build':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

定位原因为缺少GCC套件

 2、安装GCC

[[email protected] build]# yum install gcc
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc.x86_64.0.4.8.5-44.el7 将被 安装
--> 正在处理依赖关系 libgomp = 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 cpp = 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libgcc >= 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 glibc-devel >= 2.2.90-12,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libmpfr.so.4()(64bit),它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 libmpc.so.3()(64bit),它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在检查事务
---> 软件包 cpp.x86_64.0.4.8.5-44.el7 将被 安装
---> 软件包 glibc-devel.x86_64.0.2.17-325.el7_9 将被 安装
--> 正在处理依赖关系 glibc-headers = 2.17-325.el7_9,它被软件包 glibc-devel-2.17-325.el7_9.x86_64 需要
--> 正在处理依赖关系 glibc = 2.17-325.el7_9,它被软件包 glibc-devel-2.17-325.el7_9.x86_64 需要
--> 正在处理依赖关系 glibc-headers,它被软件包 glibc-devel-2.17-325.el7_9.x86_64 需要
---> 软件包 libgcc.x86_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libgcc.x86_64.0.4.8.5-44.el7 将被 更新
---> 软件包 libgomp.x86_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libgomp.x86_64.0.4.8.5-44.el7 将被 更新
---> 软件包 libmpc.x86_64.0.1.0.1-3.el7 将被 安装
---> 软件包 mpfr.x86_64.0.3.1.1-4.el7 将被 安装
--> 正在检查事务
---> 软件包 glibc.x86_64.0.2.17-222.el7 将被 升级
--> 正在处理依赖关系 glibc = 2.17-222.el7,它被软件包 glibc-common-2.17-222.el7.x86_64 需要
---> 软件包 glibc.x86_64.0.2.17-325.el7_9 将被 更新
---> 软件包 glibc-headers.x86_64.0.2.17-325.el7_9 将被 安装
--> 正在处理依赖关系 kernel-headers >= 2.2.1,它被软件包 glibc-headers-2.17-325.el7_9.x86_64 需要
--> 正在处理依赖关系 kernel-headers,它被软件包 glibc-headers-2.17-325.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 glibc-common.x86_64.0.2.17-222.el7 将被 升级
---> 软件包 glibc-common.x86_64.0.2.17-325.el7_9 将被 更新
---> 软件包 kernel-headers.x86_64.0.3.10.0-1160.45.1.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

===============================================================================================================================================================================================
 Package                                         架构                                    版本                                                   源                                        大小
===============================================================================================================================================================================================
正在安装:
 gcc                                             x86_64                                  4.8.5-44.el7                                           base                                      16 M
为依赖而安装:
…………
 mpfr                                            x86_64                                  3.1.1-4.el7                                            base                                     203 k
为依赖而更新:
 glibc                                           x86_64                                  2.17-325.el7_9                                         updates                                  3.6 M
…………

事务概要
===============================================================================================================================================================================================
安装  1 软件包 (+6 依赖软件包)
升级           ( 4 依赖软件包)

总下载量:49 M
Is this ok [y/d/N]: y
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/11): glibc-2.17-325.el7_9.x86_64.rpm                                                                                                                                 | 3.6 MB  00:00:10     
(2/11): glibc-devel-2.17-325.el7_9.x86_64.rpm                                                                                                                           | 1.1 MB  00:00:02     
…………
(11/11): gcc-4.8.5-44.el7.x86_64.rpm                                                                                                                                    |  16 MB  00:00:28     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                           1.7 MB/s |  49 MB  00:00:29     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : libgcc-4.8.5-44.el7.x86_64                                                                                                                                                1/15 
  正在更新    : glibc-2.17-325.el7_9.x86_64                                                                                                                                               2/15 
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
…………
  验证中      : glibc-2.17-222.el7.x86_64                                                                                                                                                14/15 
  验证中      : libgcc-4.8.5-28.el7.x86_64                                                                                                                                               15/15 

已安装:
  gcc.x86_64 0:4.8.5-44.el7                                                                                                                                                                    

作为依赖被安装:
  cpp.x86_64 0:4.8.5-44.el7    glibc-devel.x86_64 0:2.17-325.el7_9    glibc-headers.x86_64 0:2.17-325.el7_9    kernel-headers.x86_64 0:3.10.0-1160.45.1.el7    libmpc.x86_64 0:1.0.1-3.el7   
  mpfr.x86_64 0:3.1.1-4.el7   

作为依赖被升级:
  glibc.x86_64 0:2.17-325.el7_9                 glibc-common.x86_64 0:2.17-325.el7_9                 libgcc.x86_64 0:4.8.5-44.el7                 libgomp.x86_64 0:4.8.5-44.el7                

完毕!

3、继续安装GLIBC_2.18

[[email protected] build]# ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking for suffix of object files... o
…………
config.status: creating Makefile
config.status: creating config.h
config.status: executing default commands
[[email protected] build]#

Make -j4

[[email protected] build]sudo make -j4
[sudo] lht 的密码:
[BEGIN] 2021/11/16 11:10:46
.././scripts/mkinstalldirs /usr/local/glibc-2.18/build/dlfcn
mkdir -p -- /usr/local/glibc-2.18/build/dlfcn
echo '' > /usr/local/glibc-2.18/build/dlfcn/stamp.osT
mv -f /usr/local/glibc-2.18/build/dlfcn/stamp.osT /usr/local/glibc-2.18/build/dlfcn/stamp.os
echo '' > /usr/local/glibc-2.18/build/dlfcn/stamp.oST
…………
…………
后面输出一堆,需要等一会

make install

[[email protected] build]$ sudo make install
[sudo] lht 的密码:
LANGUAGE=C LC_ALL=C; export LANGUAGE LC_ALL; \
make -r PARALLELMFLAGS="" -C .. objdir=`pwd` install
make[1]: Entering directory `/usr/local/glibc-2.18'
make  subdir=csu -C csu ..=../ subdir_lib
…………
…………
后面输出一堆,需要等一会

4、验证安装结果

[[email protected] build]$ ldd --version
ldd (GNU libc) 2.18
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.
由 Roland McGrath 和 Ulrich Drepper 编写。
[[email protected] build]$ 

查看已安装的所有版本

[[email protected] build]$ strings /lib64/libc.so.6 | grep GLIBC
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
…………
GLIBC_2.16
GLIBC_2.17
GLIBC_2.18
GLIBC_PRIVATE
___sys_nerr_GLIBC_2_1
___sys_nerr_GLIBC_2_3
___sys_nerr_GLIBC_2_4
…………

glibc-2.18安装完毕