'fatal error: linux/compiler-gcc5.h: No such file or directory' during bitbake

18,438

As you're fetching the kernel directly from Linus' tree, the 3.16 version does not support building with gcc5.

If you change to instead fetch from git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git, i.e. the stable tree, and change to 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"

then you should be able to build the kernel without any issue.

Share:
18,438
karobar
Author by

karobar

Been a eukaryote for the last 30 or so years and I think I might be starting to get the hang of it. Experience: Extrauterine Human from 1991-present 31 weeks as a Fetus 840 hours as an Embryo 120 hours as a Blastocyst 96 hours as a Zygote 20 hours as a Morula When I'm not breathing or moving, you might be able to find me thinking about sexual reproduction, eating, or drinking. Favorite planet: Earth Favorite temperature: 22°C Favorite pressure: Somewhere around 101 kPa

Updated on June 04, 2022

Comments

  • karobar
    karobar almost 2 years

    I am attempting to run bitbake on a recipe with a non-yocto custom source. Using a linux-yocto source works fine, but when I attempt to use the linux-yocto-custom skeleton file provided by the yocto project files, I run into problems.

    My file structure looks a little like this:

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

    Here's my modified skeleton file (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"
    

    Here's the error log:

    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)
    

    I believe the most relevant portion is this part of the above log:

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

    I'm really stumped because a file is generated during the build 'compiler-gcc5.h' at location build/tmp/work/test-poky-linux/core-image-test/1.0-r0/rootfs/usr/src/kernel/include/linux/compiler-gcc5.h. What's going on here? It seems to me that this header file's being requested before being fetched but I don't know how to fix that.

  • Bernardo Rodrigues
    Bernardo Rodrigues over 5 years
    I'm trying to build Linux kernel v2.6... getting the same error but with gcc 6... will this solution work for me as well?