zoukankan      html  css  js  c++  java
  • 编译gcc报错make[3]: Leaving directory `/usr/local/src/gcc-7.4.0/build/gcc' make[2]: *** [all-stage1-gcc] Error 2 处理

    因业务需要安装7.4高版本gcc时报错:

     configure: error: in `/usr/local/src/gcc-7.4.0/build/gcc':

    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
    See `config.log' for more details.

     make[3]: Leaving directory `/usr/local/src/gcc-7.4.0/build/gcc'

    make[2]: *** [all-stage1-gcc] Error 2
    make[2]: Leaving directory `/usr/local/src/gcc-7.4.0/build'
    make[1]: *** [stage1-bubble] Error 2
    make[1]: Leaving directory `/usr/local/src/gcc-7.4.0/build'
    make: *** [all] Error 2

     解决:

    yum install -y glibc-headers gcc-c++ #参考链接https://www.cnblogs.com/niocai/archive/2011/11/04/2236458.html

    知识点扩展:

    在网上寻找解决方案时碰到一些人说是因内存不足需要添加swap分区来解决,未实际验证,这里给出添加swap分区的方法

    添加命令

    SWAP=/tmp/swap

    dd if=/dev/zero of=$SWAP bs=1M count=500 #500为swap分区大小

    mkswap $SWAP

    swapon $SWAP #启用swap

    当发现swap分区不够用,想继续加大时,需要先关闭正在使用的swap分区,然后重新分配

    swapoff /tmp/swap 或者swapoff -a这两个命令均可关闭swap分区

    注意:如果不关闭现有swap分区但想继续扩容swap分区时,当执行dd命令时会报如下错:

    dd: failed to open ‘/tmp/swap’: Text file busy

    另外根据需要可以将swap写入/etc/fstab使其永久生效

    /tmp/swap swap swap defaults 0 0

  • 相关阅读:
    Vue2 组件注册
    Vue2 CSS 过渡
    Vue2 过滤器
    Vue2 路由
    网页一次滚动一屏幕效果
    JavaScript作用域-声明提升(个人总结)
    JS函数作用域提升
    如何以计算机的方式去思考
    常用Git命令总结
    关于RBAC(Role-Base Access Control)的理解(转)
  • 原文地址:https://www.cnblogs.com/godfather007/p/10444270.html
Copyright © 2011-2022 走看看