linux 6.18.2 + clang +thinlto: can't compile zfs-dkms
System information
AlmaLinux 10 on x86_64 kernel-ml-6.18.2 from https://elrepo.org/linux/kernel/el10/SRPMS/kernel-ml-6.18.2-2.el10.elrepo.nosrc.rpm openzfs-2.4.0 from freshly cloned github with ./configure --with-config=srpm; make dist => generates zfs-2.4.0.tar.gz; zfs-2.4.0-1.el10.src.rpm; zfs-dkms-2.4.0-1.el10.src.rpm. Built and installed the two srpm without issues.
kernel configured as env LC_ALL=C.UTF-8 TMPDIR=/var/tmp make LLVM=1 CC="ccache clang" oldconfig => enable ThinLTO, followed by enabling CLANG_CFI
doing the rpm build step with extraversion set to .clang.thinlto + installation
Observed failure
dkms install -m zfs -v 2.4.0 -k 6.18.2-2.clang.thinlto.el10.x86_64
How to reproduce:
cd /var/lib/dkms/zfs/2.4.0/build env LC_ALL=C.UTF-8 TMPDIR=/var/tmp LLVM=1 LLVM_IAS=1 CC="ccache clang" LD=ld.lld ./configure --with-linux=/lib/modules/6.18.2-2.clang.thinlto.el10.x86_64/build --with-linux-obj=/lib/modules/6.18.2-2.clang.thinlto.el10.x86_64/build
The error is checking whether mutex_lock() is GPL-only... yes configure: error: *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible *** with the CDDL license and will prevent the module linking stage *** from succeeding. You must rebuild your kernel without this *** option enabled.
That error does not occur on kernel 6.18.2 compiled with gcc.
Source: openzfs/zfs