Warning: the compiler differs from the one used to build the kernel | CC=clang gives more errors

Hi all,

I found another post that might be related.
I get the warning in the title when I run “make” to build a kernel module:

❯ make
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: clang version 21.1.6
  You are using:           gcc (GCC) 15.2.1 20251112
  CC [M]  it87.o
gcc: error: unrecognized command-line option ‘-mstack-alignment=8’
gcc: error: unrecognized command-line option ‘-mretpoline-external-thunk’
gcc: error: unrecognized command-line option ‘-fsplit-lto-unit’
make[3]: *** [/usr/lib/modules/6.18.2-2-cachyos/build/scripts/Makefile.build:287: it87.o] Error 1
make[2]: *** [/usr/lib/modules/6.18.2-2-cachyos/build/Makefile:2016: .] Error 2
make[1]: *** [Makefile:248: __sub-make] Error 2
make: *** [Makefile:81: modules] Error 2

I also tried specifying Clang as the compiler to use:

❯ make CC=clang
  CC [M]  it87.o
it87.c:3454:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
 3454 |                 default:
      |                 ^
it87.c:3454:3: note: insert 'break;' to avoid fall-through
 3454 |                 default:
      |                 ^
      |                 break; 
1 warning generated.
ld: unrecognised emulation mode: llvm
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386pep i386pe elf64bpf
make[3]: *** [/usr/lib/modules/6.18.2-2-cachyos/build/scripts/Makefile.build:287: it87.o] Error 1
make[3]: *** Deleting file 'it87.o'
make[2]: *** [/usr/lib/modules/6.18.2-2-cachyos/build/Makefile:2016: .] Error 2
make[1]: *** [Makefile:248: __sub-make] Error 2
make: *** [Makefile:81: modules] Error 2

Does anyone know why I can’t build the module using make alone?

Operating System: CachyOS Linux
KDE Plasma Version: 6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1
Kernel Version: 6.18.2-2-cachyos (64-bit)
Graphics Platform: Wayland
Processors: 20 × 13th Gen Intel® Core™ i5-13600K
Memory: 16 GiB of RAM (15.4 GiB usable)
Graphics Processor 1: AMD Radeon RX 7600
Graphics Processor 2: Intel® Graphics
Manufacturer: Gigabyte Technology Co., Ltd.
Product Name: B760M GAMING X DDR4

Since late 2024 (starting with kernel 6.11+), CachyOS’s default linux-cachyos kernel is compiled with Clang + ThinLTO for better performance. This is intentional and recommended.
However, many out-of-tree modules (like it87, some DKMS drivers, or manual builds) assume a GCC-built kernel or don’t fully support Clang’s build environment, leading to mismatches.

$ ld -v
GNU ld (GNU Binutils) 2.45.1

Because it’s clang you need this linker
$ ld.lld -v
LLD 21.1.6 (compatible with GNU linkers)

Maybe you try:
$ make LLVM=1

This uses clang, ld.lld (LLVM linker), and integrated assembler, avoiding the ld emulation issue and unrecognized flags.If that works, it’s the cleanest fix.

If LLVM=1 Fails
Install/update full LLVM packages: sudo pacman -Syu llvm lld clang.

I reinstalled the LLVM packages, but it still don’t work seem to work.

❯ make LLVM=1
  CC [M]  it87.o
it87.c:3454:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
 3454 |                 default:
      |                 ^
it87.c:3454:3: note: insert 'break;' to avoid fall-through
 3454 |                 default:
      |                 ^
      |                 break; 
1 warning generated.
  MODPOST Module.symvers
  CC [M]  it87.mod.o
  CC [M]  .module-common.o
  LD [M]  it87.ko
  BTF [M] it87.ko
❯ sudo make install
mkdir -p /lib/modules/6.18.2-2-cachyos/kernel/drivers/hwmon
cp it87.ko /lib/modules/6.18.2-2-cachyos/kernel/drivers/hwmon/
depmod -a -F /proc/kallsyms 6.18.2-2-cachyos
❯ sudo modprobe it87
modprobe: ERROR: could not insert 'it87': No such device

The modprobe: ERROR: could not insert ‘it87’: No such device error is very common with the it87 driver and almost never means the module is broken. It usually happens for one (or more) of these reasons:

Your motherboard’s ITE Super I/O chip is a newer/unsupported variant (e.g., IT8688E, IT8695E, IT8689E, etc.). The in-kernel it87 driver only supports older chips officially. Newer ones often need parameters to “force” detection.
ACPI resource conflict — The BIOS/ACPI claims the I/O ports, blocking the driver.
The chip isn’t auto-detected properly without hints.

First, run sensors-detect (as root) to identify your chip:

sudo sensors-detect --auto

Answer YES to all prompts (it’s safe). Look for lines like:

Found unknown chip with ID 0xXXXX

or

Found 'ITE IT86xxE Super IO Sensors' (address 0xYYY, driver `to-be-written')

Then, try loading with common parameters (as root):

sudo modprobe it87 ignore_resource_conflict=1

If that fails with the same error, add a force_id (common ones for modern boards)

sudo modprobe it87 ignore_resource_conflict=1 force_id=0x8688

Other frequent IDs to test: 0x8628, 0x8622, 0x8686, 0x8695

After each successful load, run:

sensors

and check dmesg | grep it87 for clues (e.g., “Found IT86xxE chip”, voltages/fans/temps).
To make it permanent (once you find the working combo):

echo "options it87 ignore_resource_conflict=1 force_id=0xXXXX" | sudo tee /etc/modprobe.d/it87.conf
echo "it87" | sudo tee -a /etc/modules
sudo depmod -a

Reboot and test.

If That Doesn’t Work: Use the Updated Out-of-Tree Driver
The version you’re building manually is likely old and lacks support for many recent ITE chips (common on Gigabyte/Asus/MSI boards).
The best maintained fork is frankcrawford/it87 on GitHub, which adds support for chips like IT8686E/8688E/8689E/8695E and works great on Clang kernels.

There’s an AUR package: it87-dkms-git

yay -S it87-dkms-git   # or paru, etc.

Or build manually:

git clone https://github.com/frankcrawford/it87.git
cd it87
make LLVM=1
sudo make install

Alternatives If it87 Remains Stubborn

Try nct6775 module (Nuvoton chips on some boards)

sudo modprobe nct6775
sensors

Post the output of sudo sensors-detect (or at least the ITE part) and dmesg | grep it87 after trying the modprobe commands — that’ll pinpoint the exact chip and fix

The issue isn’t modprobe because the it87 module isn’t even listed when I run lsmod.
I think the module isn’t build or installed correctly.
But thanks for your help.
I tried building with make alone because my CPU fan wasn’t working with make dkms.

Does modinfo find the module?
$ sudo modinfo it87

Try loading directly
$ sudo insmod -v ./it87.ko

Perhaps you’ve to load this ‘depends’ first:
$ sudo modinfo it87 | grep depends
depends: hwmon-vid
$ sudo insmod /lib/modules/6.18.2-2-cachyos/kernel/drivers/hwmon/hwmon-vid.ko.zst
$ sudo insmod -v ./it87.ko # your compiled module

modinfo finds is the preinstalled one, which is outdated (I think).

❯ sudo modinfo it87
[sudo] password for linux: 
filename:       /lib/modules/6.18.2-2-cachyos/kernel/drivers/hwmon/it87.ko.zst
author:         Chris Gauthron, Jean Delvare <jdelvare@suse.de>
description:    IT8705F/IT871xF/IT872xF hardware monitoring driver
license:        GPL
name:           it87
intree:         Y
depends:        hwmon-vid
alias:          dmi*:rvn*nVIDIA*:rn*FN68PT*:
srcversion:     BC9B0FE462169CBCF80ACFF
vermagic:       6.18.2-2-cachyos SMP preempt mod_unload 
retpoline:      Y
sig_id:         PKCS#7
signer:         Build time autogenerated kernel key
sig_key:        57:77:63:AF:B8:27:39:13:2A:37:75:43:C7:EA:DA:25:0F:EF:20:70
sig_hashalgo:   sha512
signature:      30:64:02:30:76:1C:5F:04:73:C3:EB:03:B8:FF:63:22:28:25:93:02:
                15:A7:21:AC:A2:96:32:1B:F6:18:D6:7B:55:D5:07:72:53:62:E1:CE:
                CD:AB:65:CA:CC:02:D9:80:D6:54:64:0B:02:30:7C:2C:E5:D4:76:C7:
                2F:D0:6B:17:DE:B2:D4:31:DB:B3:43:5B:90:A2:DE:2A:74:1E:B6:96:
                2C:91:1B:F2:08:65:4E:01:1B:D9:43:BA:D7:36:08:20:B2:76:0A:77:
                B5:62
parm:           fix_pwm_polarity:Force PWM polarity to active high (DANGEROUS) (bool)
parm:           update_vbat:Update vbat if set else return powerup value (bool)
parm:           ignore_resource_conflict:Ignore ACPI resource conflict (bool)
parm:           force_id:Override one or more detected device ID(s) (array of ushort)

and so does modprobe

which still tries to load the ‘old’ one

and not the new one

which looks like a wonky install anyway.

To verify what I think happens do a dry-run:

$ sudo modprobe --dry-run -v it87