Centos7中gcc安装过程中报错:make[2]: 离开目录make[1]: *** [stage1-bubble] 错误 2make[1]: 离开目录make: *** [all] 错误 2

最近在安装GCC的时候遇到了报错:

然后我上网找了很久,首先参考了这篇文章Centos下gcc的安装、gcc的更新、gcc安装过程中报错:make[1]: *** [stage1-bubble] 错误 2_make[1]: *** [stage1-bubble] error 2-CSDN博客

但是我按照文章步骤手动编译完四个包之后还是报相同的错,后面我又搜了很久,综合下来我的理解是缺少了g++,然后g++又需要用yum命令去下载和更新,但是好像看到一篇文章说现在CentOS7不再维护更新yum了(好像,我也不清楚)。所以在使用yum命令的时候又会报错如下:

Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
 
 
 One of the configured repositories failed (未知),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:
     1. Contact the upstream for the repository and get them to fix the problem.
     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).
     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...
     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:
 
            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>
 
     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:
 
            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true
 
Cannot find a valid baseurl for repo: base/x86_64

所以我的解决步骤是首先修复yum,再用yum下载和更新g++。

修复yum的文章是这一篇
yum update失败,错误:14: curl#6 - “Could not resolve host: mirrorlist.centos.org; 未知的错误“_14: curl#6 - "could not resolve host: mirrorlist.c-CSDN博客

下载源文件之后替换原来的文件,然后

yum clean all

yum makecache

yum update

这就修复好yum了,然后再来下载g++

su -

输入密码进入root

yum install gcc-c++

查看版本验证是否安装成功

g++ --version
 

yum和g++弄好之后,使用make distclean或者make clean清除之前报错的构建,然后现在你再进行GCC的安装就不会报错啦

  • 12
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
### 回答1: 在CentOS 7安装glibc2.29时遇到"make: *** 没有指明目标并且找不到 makefile。 停止"错误的问题,可能是由于缺少相应的依赖库或配置不正确导致的。您可以尝试以下解决方案: 1. 更新系统:使用以下命令更新系统的所有软件包,以确保您的系统处于最新状态: ``` sudo yum update ``` 2. 检查依赖库:确认是否已安装glibc的相关依赖库,可以使用以下命令检查: ``` rpm -qa | grep glibc-devel ``` 如果没有任何输出或输出为空,则需要安装相关依赖库: ``` sudo yum install glibc-devel ``` 3. 设置LD_LIBRARY_PATH环境变量:确保LD_LIBRARY_PATH环境变量已正确设置,该变量指定了共享库的搜索路径。可以使用以下命令检查: ``` echo $LD_LIBRARY_PATH ``` 如果没有任何输出或输出为空,则需要设置LD_LIBRARY_PATH环境变量。打开/etc/profile文件并添加以下行: ``` export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ``` 保存文件并执行以下命令以使更改生效: ``` source /etc/profile ``` 4. 清除并重新编译:如果上述解决方法都无效,您可以尝试先清除之前编译的文件并重新编译: ``` make clean make ``` 如果仍然出现相同的错误,请确保您已按照正确的步骤和依赖项安装了glibc2.29,并根据错误提示进一步调查并解决问题。 ### 回答2: 解决CentOS 7安装glibc 2.29报错"make: *** 没有指明目标并且找不到 makefile。 停止。"的问题,可以尝试以下步骤: 1. 首先确认是否已经安装了必要的开发工具和软件包,比如gccmake、cmake等。可以使用以下命令进行安装: sudo yum install gcc make cmake 2. 接下来,下载并解压glibc 2.29的源代码。可以从glibc官方网站或者其他可信的源获取。解压后进入源代码目录。 3. 在源代码目录,使用以下命令生成Makefile文件: mkdir build cd build ../configure 这些命令将在build文件夹下生成Makefile文件。 4. 接着,执行以下命令进行编译和安装make sudo make install 这些命令将编译源代码并安装到系统。 如果以上步骤执行过程仍然遇到"make: *** 没有指明目标并且找不到 makefile。 停止。"的错误消息,可以考虑以下方法进行解决: 1. 检查是否有编译依赖项缺失,并安装相关依赖项。可以使用以下命令查找缺失的依赖项: sudo yum provides */make sudo yum provides */gcc 根据结果安装相应的依赖项。 2. 检查是否在正确的目录执行了命令。确保在源代码的根目录或者生成的build文件夹执行命令。 3. 检查源代码是否正确,是否完整。重新下载源代码并解压,再次尝试编译和安装。 以上是解决CentOS 7安装glibc 2.29报错"make: *** 没有指明目标并且找不到 makefile。 停止。"的一般步骤和方法,根据具体情况可能会有所不同。建议参考官方文档或相关社区的讨论来获取更详细和具体的解决方案。 ### 回答3: 在CentOS 7安装glibc2.29时出现"make: *** 没有指明目标并且找不到 makefile。 停止。"这个错误,可能是由于缺少必要的依赖或者编译选项配置错误造成的。 解决这个问题的方法如下: 1. 确保系统已经安装了必要的编译工具,包括gccmake等。可以使用以下命令安装: ``` sudo yum install gcc make ``` 2. 检查系统是否已经安装了必要的依赖库,包括glibc-devel、glibc-static等。可以使用以下命令进行检查和安装: ``` sudo yum install glibc-devel glibc-static ``` 3. 如果以上步骤都已经完成,那可能是在配置编译选项时出现了错误。可以尝试使用以下命令重新配置并编译安装: ``` ./configure make sudo make install ``` 如果还是无法解决问题,可以尝试在配置时添加一些选项,例如: ``` ./configure --prefix=/usr/local/glibc2.29 ``` 然后重新编译安装。 4. 如果以上方法还是无法解决问题,可以考虑升级或者重新安装CentOS 7操作系统。也可以尝试使用其他方式安装glibc2.29,例如使用源码安装、使用包管理器安装等。 总之,在解决安装glibc2.29报错"make: *** 没有指明目标并且找不到 makefile。 停止。"时,需要确保系统已经安装了必要的依赖和编译工具,并正确配置编译选项。如果问题依然存在,可以考虑其他解决办法或者尝试使用其他方式安装glibc2.29。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值