Compling uboot error: linux/compiler-gcc7.h: No such file or directory (rpi-r2)


(Weiqi Chen) #1

Hello guys,

I’m trying to compile uboot by myself, I use the code from https://github.com/BPI-SINOVOIP/BPI-R2-bsp.git/u-boot-mt

ARCH=arm make menuconfig
#modify Makefile a little.
git diff Makefile
diff --git a/u-boot-mt/Makefile b/u-boot-mt/Makefile
index b3b206e46..446ebc2ac 100755
--- a/u-boot-mt/Makefile
+++ b/u-boot-mt/Makefile
@@ -206,7 +206,7 @@ CROSS_COMPILE ?=
 endif
 
 CROSS_COMPILE_PATH = /opt/buildroot-gcc463_arm/usr/bin
-CROSS_COMPILE = $(CROSS_COMPILE_PATH)/arm-buildroot-linux-uclibcgnueabi-
+CROSS_COMPILE = arm-linux-gnueabihf-
 
 # SHELL used by kbuild
 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \

make
  GEN     include/autoconf.mk.dep
In file included from /home/weiqi/u-boot-mt/include/linux/compiler.h:40:0,
                 from /home/weiqi/u-boot-mt/include/linux/byteorder/little_endian.h:12,
                 from /home/weiqi/u-boot-mt/arch/arm/include/asm/byteorder.h:29,
                 from /home/weiqi/u-boot-mt/include/compiler.h:112,
                 from /home/weiqi/u-boot-mt/include/image.h:19,
                 from /home/weiqi/u-boot-mt/include/common.h:97:
/home/weiqi/u-boot-mt/include/linux/compiler-gcc.h:95:1: fatal error: linux/compiler-gcc7.h: No such file or directory
 #include gcc_header(__GNUC__)
 ^~~~
compilation terminated.
  GEN     include/autoconf.mk
In file included from /home/weiqi/u-boot-mt/include/linux/compiler.h:40:0,
                 from /home/weiqi/u-boot-mt/include/linux/byteorder/little_endian.h:12,
                 from /home/weiqi/u-boot-mt/arch/arm/include/asm/byteorder.h:29,
                 from /home/weiqi/u-boot-mt/include/compiler.h:112,
                 from /home/weiqi/u-boot-mt/include/image.h:19,
                 from /home/weiqi/u-boot-mt/include/common.h:97:
/home/weiqi/u-boot-mt/include/linux/compiler-gcc.h:95:1: fatal error: linux/compiler-gcc7.h: No such file or directory
 #include gcc_header(__GNUC__)
 ^~~~
compilation terminated.
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  UPD     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CC      lib/asm-offsets.s
In file included from /home/weiqi/u-boot-mt/include/linux/compiler.h:40:0,
                 from /home/weiqi/u-boot-mt/include/linux/byteorder/little_endian.h:12,
                 from /home/weiqi/u-boot-mt/arch/arm/include/asm/byteorder.h:29,
                 from /home/weiqi/u-boot-mt/include/compiler.h:112,
                 from /home/weiqi/u-boot-mt/include/image.h:19,
                 from /home/weiqi/u-boot-mt/include/common.h:97,
                 from lib/asm-offsets.c:15:
/home/weiqi/u-boot-mt/include/linux/compiler-gcc.h:95:1: fatal error: linux/compiler-gcc7.h: No such file or directory
 #include gcc_header(__GNUC__)
 ^~~~
compilation terminated.
/home/weiqi/u-boot-mt/./Kbuild:34: recipe for target 'lib/asm-offsets.s' failed
make[1]: *** [lib/asm-offsets.s] Error 1
Makefile:1040: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

The version of gcc

arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Ubuntu/Linaro 7.2.0-6ubuntu1) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Anybody know what is happening?


(Weiqi Chen) #2

Problem sloved. Use the toolchain from here https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads


(Frank W.) #3

Which host-OS do you using?

If ubuntu why not using the crosscompiler-package as mentioned on the github-repo?

Gcc 7 is not supported yet…please use gcc6

you can try to put this file to “include/linux/”: compiler-gcc7.h (2,4 KB)


BPI R2 USB or Else Camera Sugession
(Frank W.) #4

my repo is also not compilable with gcc because of false-positive error in wifi-driver


#5

So is there a way to compile on Ubuntu host with native Ubuntu tools? gcc-6-arm-linux-gnueabihf:

/bin/sh: 1: arm-linux-gnueabihf-gcc: not found

gcc-arm-linux-gnueabihf:

BPI-R2-bsp-4.14/u-boot-mt/include/linux/compiler-gcc.h:95:1: fatal error: linux/compiler-gcc8.h: No such file or directory

(Frank W.) #6

Your log says you use gcc8 crosscompiler…if you want to use gcc6 or any other you have to change it via update-alternatives

gcc7 (ubuntu 18.4) is supported

example for update-alternatives (here i’ve done for gcc8, which is already your default, so just replace 8 by another number):

sudo apt-get install gcc-8-arm-linux-gnueabihf
sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-8 50
sudo update-alternatives --config arm-linux-gnueabihf-gcc
arm-linux-gnueabihf-gcc --version

i added compiler-gcc8.h in lts-branches (4.14+4.19), installed gcc8 on my system and can compile these 2 branches without errors

but i see you use official 4.14-repo where i cannot add these…you can add these file from my repo, but maybe compile failes because of missing Patches in wifi-driver

so just clone my repo

and run build.sh like described in README.md (you see this if you open the repo in your browser)