This is a cache of https://discuss.96boards.org/t/hikey960-build-break-on-android-hikey-linaro-4-19/8888. It is a snapshot of the page at 2024-10-31T12:47:27.486+0000.
[Hikey960] build break on android-hikey-linaro-4.19 - HiKey 960 - 96Boards Forum

[Hikey960] build break on android-hikey-linaro-4.19

I cloned the 960 kernel from “kernel/hikey-linaro - Git at Google” but encounter the build break on branch “android-hikey-linaro-4.19” by following the steps from the website.

Steps:
git clone https://android.googlesource.com/kernel/hikey-linaro
cd hikey-linaro
git checkout -b android-hikey-linaro-4.19 origin/android-hikey-linaro-4.19
make ARCH=arm64 hikey960_defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -j24

The error log is showing as below and does anyone have an idea for how to fix it? Thanks.

In file included from ././include/linux/compiler_types.h:64:0,
                 from <command-line>:0:
./arch/arm64/include/asm/jump_label.h: In function 'br_nf_post_routing':
./include/linux/compiler-gcc.h:164:38: warning: asm operand 0 probably doesn't match constraints
 #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
                                      ^
./arch/arm64/include/asm/jump_label.h:31:2: note: in expansion of macro 'asm_volatile_goto'
  asm_volatile_goto("1: nop\n\t"
  ^
./include/linux/compiler-gcc.h:164:38: error: impossible constraint in 'asm'
 #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
                                      ^
./arch/arm64/include/asm/jump_label.h:31:2: note: in expansion of macro 'asm_volatile_goto'
  asm_volatile_goto("1: nop\n\t"
  ^
scripts/Makefile.build:333: recipe for target 'net/bridge/br_netfilter_hooks.o' failed
make[2]: *** [net/bridge/br_netfilter_hooks.o] Error 1
scripts/Makefile.build:638: recipe for target 'net/bridge' failed
make[1]: *** [net/bridge] Error 2
Makefile:1113: recipe for target 'net' failed
make: *** [net] Error 2

#### failed to build some targets (05:31 (mm:ss)) ####

It will work if you use the branch “android-hikey-linaro-4.14”. For now, it seems no one knows how to solve the problem in branch 4.19 here.

Hi,

I think the building error is related with compiler. I use the toolchain is:

$ aarch64-linux-gnu-gcc --version
aarch64-linux-gnu-gcc (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1) 7.4.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.

Please check if you are using an old version cross compiler and need to update to newer one.

hi aachen,
i am getting same issue with 4.19 kernel.
please let me know, have u solved thr compailer issue.

regards
sukesh

do you mean that CROSS_COMPILE=aarch64-linux-android- is same as aarch64-linux-gnu-gcc ? i found that , after source ./build/envsetup.sh and lunch hikey960-userdebug in aosp dir, i found the error aarch64-linux-android-gcc not found, while build hikey-linaro kernel.
wait for your response.Thanks.

Thanks for reporting this. It’s true that I cannot find aarch64-linux-android-gcc from AOSP’s aarch64 toolchain; I am not sure if this is because now Android is mainly using LLVM/Clang for the building so GCC toolchain is not updated anymore. I need to check internally for this.

At the mean time, you could try the toolchain [1] or [2] for Linux kernel building; usually you need to select the toolchian for AArch64 GNU/Linux target (aarch64-none-linux-gnu).

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image.gz dtbs

Updated: GCC is deprecated in AOSP; either download GCC toolchain from Arm or Linaro website, or refer the thread [3] to use Clang for building kernel.

[1] GNU Toolchain | GNU-A Downloads – Arm Developer
[2] https://releases.linaro.org/components/toolchain/binaries/latest-7/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
[3] Is it able to use clang to build hikey-linaro?