linux gcc6,linux 内核编译 错误 fatal error: linux/compiler-gcc6.h: No such file or directory

在尝试交叉编译i.MX6UL的Linux内核2.6.32版本时,遇到了因使用过高版本的GCC工具链(6.2.1)导致的编译错误。内核源码中只支持到GCC 4版本的头文件。解决方案包括降级交叉编译工具链至兼容版本或升级内核源码至支持更高版本GCC的版本。

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

在交叉编译i.MX6UL的Kernel代码时出现这个错误

CHK include/config/kernel.release

Using .. as source for kernel

GEN ./Makefile

CHK include/generated/uapi/linux/version.h

CHK include/generated/utsrelease.h

make[3]: ‘include/generated/mach-types.h’ is up to date.

CC kernel/bounds.s

In file included from ../include/linux/compiler.h:54:0,

from ../include/uapi/linux/stddef.h:1,

from ../include/linux/stddef.h:4,

from ../include/uapi/linux/posix_types.h:4,

from ../include/uapi/linux/types.h:13,

from ../include/linux/types.h:5,

from ../include/linux/page-flags.h:8,

from ../kernel/bounds.c:9:

../include/linux/compiler-gcc.h:121:30: fatal error: linux/compiler-gcc6.h: No such file or directory

#include gcc_header(GNUC)

^

compilation terminated.

原因是因为我使用的交叉编译工具链版本太高(6.2.1版本)导致,先在内核代码根目录下搜索

[root@localhost linux-2.6.32]# find . -name "compiler-gcc*"

./include/linux/compiler-gcc.h

./include/linux/compiler-gcc3.h

./include/linux/compiler-gcc4.h

[root@localhost linux-2.6.32]#

支持的版本有3、4。

解决方案:下载 高版本内核 或者 低版本交叉编译链

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值