linux - bitbake 期间出现“ fatal error : linux/compiler-gcc5. h:没有此类文件或目录”

标签 linux gcc yocto bitbake openembedded

我正在尝试使用非 yocto 自定义源对配方运行 bitbake。使用 linux-yocto 源工作正常,但是当我尝试使用 yocto 项目文件提供的 linux-yocto-custom 框架文件时,我遇到了问题。

我的文件结构看起来有点像这样:

meta-test
|
.
.
.
+--recipes-kernel/
   |
   +--linux/
       |
       +--linux-yocto-custom_3.16.bb
       +--linux-yocto-custom/
          |
          +--defconfig

这是我修改后的骨架文件(linux-yocto-custom_3.16.bb):

inherit kernel
require recipes-kernel/linux/linux-yocto.inc
SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git;protocol=git;nocheckout=1;name=machine"
SRC_URI += "file://defconfig"
LINUX_VERSION ?= "3.16"
LINUX_VERSION_EXTENSION_append = "-custom"
SRCREV_test="19583ca584d6f574384e17fe7613dfaeadcdc4a6"
PV = "${LINUX_VERSION}+git${SRCPV}"
COMPATIBLE_MACHINE = "test"

这是错误日志:

DEBUG: Executing shell function do_compile
NOTE: make -j 4 bzImage CC=i586-poky-linux-gcc  -fuse-ld=bfd LD=i586-poky-linux-ld.bfd 
make[1]: Entering directory `/home/me/poky/build/tmp/work/test-poky-linux/linux-yocto-custom/3.16+gitAUTOINC+19583ca584-r0/linux-test-standard-build'
  GEN     ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
  SYSTBL  arch/x86/syscalls/../include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
  CHK     include/config/kernel.release
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
  UPD     include/config/kernel.release
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
  GEN     ./Makefile
  WRAP    arch/x86/include/generated/asm/clkdev.h
  WRAP    arch/x86/include/generated/asm/early_ioremap.h
  WRAP    arch/x86/include/generated/asm/cputime.h
  WRAP    arch/x86/include/generated/asm/mcs_spinlock.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  CC      scripts/mod/empty.o
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/devicetable-offsets.s
In file included from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/compiler.h:54:0,
                 from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/uapi/linux/stddef.h:1,
                 from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/stddef.h:4,
                 from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/uapi/linux/posix_types.h:4,
                 from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/uapi/linux/types.h:13,
                 from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/types.h:5,
                 from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/mod_devicetable.h:11,
                 from /home/me/poky/build/tmp/work-shared/test/kernel-source/scripts/mod/devicetable-offsets.c:2:
/home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/compiler-gcc.h:106:30: fatal error: linux/compiler-gcc5.h: No such file or directory
compilation terminated.
make[4]: *** [scripts/mod/devicetable-offsets.s] Error 1
make[3]: *** [scripts/mod] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [sub-make] Error 2
make: *** [__sub-make] Error 2
WARNING: /home/me/poky/build/tmp/work/test-poky-linux/linux-yocto-custom/3.16+gitAUTOINC+19583ca584-r0/temp/run.do_compile.32722:1 exit 1 from
  exit 1
ERROR: oe_runmake failed
ERROR: Function failed: do_compile (log file is located at /home/me/poky/build/tmp/work/test-poky-linux/linux-yocto-custom/3.16+gitAUTOINC+19583ca584-r0/temp/log.do_compile.32722)

我相信最相关的部分是上面日志的这一部分:

compiler-gcc.h:106:30: fatal error: linux/compiler-gcc5.h: No such file or directory

我真的很困惑,因为在构建“compiler-gcc5.h”期间生成了一个文件,位置为build/tmp/work/test-poky-linux/core-image-test/1.0-r0/rootfs/usr/src/kernel/include/linux/compiler-gcc5.h。这里发生了什么?在我看来,这个头文件在获取之前就被请求了,但我不知道如何解决这个问题。

最佳答案

由于您直接从 Linus 树中获取内核,因此 3.16 版本不支持使用 gcc5 进行构建。

如果您更改为从 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 获取,即稳定树,并更改为v3.16.7:

SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git;protocol=git;nocheckout=1;name=machine;branch=linux-3.16.y"
SRCREV_test = "d0335e4feea0d3f7a8af3116c5dc166239da7521"

那么您应该能够毫无问题地构建内核。

关于linux - bitbake 期间出现“ fatal error : linux/compiler-gcc5. h:没有此类文件或目录”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33550251/

相关文章:

c++ - 使用 Graphviz for Windows 程序可视化函数调用

cross-compiling - yocto sdk 上的 stdint.h "no such file or directory"错误

yocto - 已安装Yocto glibc-locale do_package,但未以任何软件包提供

linux-kernel - 使用自定义 YOCTO 层中的配置片段添加内核配置选项

linux - 在linux中组合两个命令并将其附加到另一个文件

linux - 通过R中变量的模糊匹配进行合并

linux - 执行上一个命令行的输出

c - 如何从任意 pthread_t 获取线程 ID?

c++ - 谜:将GNU C标签指针转换为函数指针,并使用内联asm将ret放入该 block 中。 block 被优化掉了吗?

c++ - -D_GLIBCXX_USE_CXX11_ABI=1 对 CentOS 7 上的 devtoolset-7 无效