因业务需要安装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

相关文章:

  • 2021-07-11
  • 2022-12-23
  • 2021-07-24
  • 2021-12-02
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
  • 2021-08-05
  • 2021-08-25
  • 2021-10-20
  • 2021-12-16
相关资源
相似解决方案