sm8550-sheng: build kernel with clang via KERNEL_COMPILER, not global export

The family built the kernel with clang by exporting CC="clang" and LLVM=1
globally. Those exports leak out of the kernel compilation into the
image-assembly chroot: the linux-headers postinst runs `make ... scripts`
(rebuilding scripts/basic/fixdep in the target rootfs), inherits LLVM=1, and
invokes clang - which is not installed in the image (the linux-headers package
Depends on gcc, not clang). The image build then dies with:

  make[1]: clang: No such file or directory
  /bin/sh: 1: clang: not found
  make[2]: *** [scripts/Makefile.host:114: scripts/basic/fixdep] Error 127
  dpkg: error processing package linux-headers-edge-sm8550-sheng (--configure)

Use the framework's first-class clang path instead: KERNEL_COMPILER="clang"
adds LLVM=1 only to the kernel make params, which run under `env -i`, so the
flag never escapes into the rootfs. The kernel is still built with clang;
the headers postinst rebuilds scripts with gcc (its declared dependency).

Signed-off-by: Igor Pecovnik <igor@armbian.com>
This commit is contained in:
Igor Pecovnik
2026-08-18 21:30:37 +02:00
committed by Igor
parent f95667d212
commit 3c077ad359
+6 -2
View File
@@ -26,5 +26,9 @@ case $BRANCH in
esac
export CC="clang"
export LLVM=1
# Build the kernel with clang/LLVM. Use KERNEL_COMPILER (scoped to the kernel
# make, passed as LLVM=1 under `env -i`) rather than exporting CC/LLVM globally:
# a global export leaks into the image-assembly chroot, where the linux-headers
# postinst's `make scripts` then invokes clang (not installed in the rootfs -
# the headers package Depends on gcc) and fails with "clang: not found".
declare -g KERNEL_COMPILER="clang"