[ERROR] 编译内核报错: include/linux/compiler-gcc.h:86:30: fatal error: linux/compiler-gcc5.h: No such file

编译内核时遇到如下错误,猜测make时用系统当前的gcc编译的,gcc版本太高,编译内核时在内核源代码中找不到对应的头文件。有网友说需要把/usr/src本身内核源码里面复制一个头文件进去,但是有可能找不到。因此本文解决思路是降低gcc版本。

20180620更新:在这里下一个就可以用gcc5 h了
ttps://raw.githubusercontent.com/torvalds/linux/v4.0/include/linux/compiler-gcc5.h

0x01报错信息:

include/linux/compiler-gcc.h:86:30: fatal error: linux/compiler-gcc5.h: No such file or directory
compilation terminated.
/home/thinkycx/Desktop/kernel-pwn/linux-2.6.32.1/./Kbuild:35: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:982: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2


0x02解决方案:

which gcc # 查看gcc版本
ls -al /usr/bin/gcc* # 查看系统中的所有gcc版本,如果没有请安装
sudo rm /usr/bin/g++ /usr/bin/gcc  
sudo ln -s /usr/bin/gcc-4.9 /usr/bin/gcc 
sudo ln -s /usr/bin/g++-4.9 /usr/bin/g++ 

再make就不报错了


0x03参考

https://blog.csdn.net/u014525494/article/details/53573298

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值