Centos7安装gcc、cmake、gdb

本文详细介绍了如何在Centos7系统中从源码安装GDB 8.3.1和CMake的过程。针对GDB安装过程中遇到的makeinfo版本问题进行了深入分析并提供了解决方案。同时,提供了CMake的完整安装步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Centos7从源码安装GDB (gdb-8.3.1)

参考URL: https://blog.youkuaiyun.com/chiying9447/article/details/100731156

默认情况下,Centos7自带一个低版本的GDB,使用命令# gdb -v查看

  1. 官网gdb源码
    我们需要从官网(http://www.gnu.org/software/gdb/)下载gdb-8.3.1.tar.gz源代码:

GDB官网–>Dowload面版–>SourcesSite–>gdb-8.3.1.tar.gz

  1. 解压
tar -zxvf gdb-8.3.1.tar.gz 
  1. 编译安装
cd gdb-8.3.1/
./configure
make
make install

如果make install过程中报WARNING: ‘makeinfo’ is missing on your system.错。需要先通过命令# yum install texinfo安装texinfo,删除之前make的文件(make clean)重新编译安装。

yum 安装texinfo后,make install 还是报错,如下
missing makeinfo --split-size=5000000’
configure: current value: `makeinfo --split-size=5000000’

没有安装texinfo导致的gdb安装错误
参考URL: http://blog.chinaunix.net/uid-13627944-id-4028431.html

问题分析:
查看configure代码

vi configure

可以看到如下,configure命令会执行makeinfo --version查看版本,版本不匹配,就会报missing makeinfo

case " $build_configdirs " in
  *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
  *)

    # For an installed makeinfo, we require it to be from texinfo 4.7 or
    # higher, else we use the "missing" dummy.
    if ${MAKEINFO} --version \
       | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
      :
    else
      MAKEINFO="$MISSING makeinfo"
    fi
    ;;

esac

查看我们版本

[root@localhost gdb-8.3.1]# makeinfo --version
makeinfo (GNU texinfo) 5.1

Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[root@localhost gdb-8.3.1]# 

可以看到这里在configure的时候,运行makeinfo --version,if下面的判断为 texinfo的版本为4.7以上的版本才行, 小于这个版本或者没有安装texinfo,则MAKEINFO为 $MISSING makeinfo。

这里我们的版本应该是满足了。

因此,判断原因是,虽然安装了texinfo,由于没有重新configure,MAKEINFO宏并没有改变。

于是删除编译目录的所有文件,重新解压源码,重新configure,make, make install。测试通过!

  1. 测试
[root@localhost gdb-8.3.1]# gdb -version
GNU gdb (GDB) 8.3.1
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[root@localhost gdb-8.3.1]# 

CentOS 安装Cmake

详细安装说明,官网说明如下:
https://cmake.org/install/

1 安装gcc gcc-c++

yum install -y gcc gcc-c++ make automake 
  1. 下载Cmake源码
    下载自己需要的版本
    官网下载路径:https://cmake.org/download/

  2. 执行如下命令:

tar -zxvf cmake-3.16.0.tar.gz 
cd cmake-3.16.0/
./configure 
gmake
gmake install
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

西京刀客

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值