Kernel compilation error "undefined reference"

I use a Raspberry Pi 4 to compile. It works really great 95% of the time, but on rare occasions, I get this strange error and the build tree is stuck like this from then on. make clean has no effect, it still happens every build attempt. (maybe distclean will fix it?)

  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  CHK     include/generated/compile.h
  GEN     usr/initramfs_data.cpio
  AS      usr/initramfs_data.o
  AR      usr/built-in.a
  AR      lib/lib.a
  EXPORTS lib/lib-ksyms.o
  AR      lib/built-in.a
  GEN     .version
  CHK     include/generated/compile.h
  LD      vmlinux.o
  MODPOST vmlinux.o
  MODINFO modules.builtin.modinfo
  LD      .tmp_vmlinux.kallsyms1
mipsel-openwrt-linux-musl-ld: lib/decompress.o:(.init.rodata+0x2c): undefined reference to `unlzma'
mipsel-openwrt-linux-musl-ld: lib/decompress.o:(.init.rodata+0x38): undefined reference to `unlzma'
make[5]: *** [Makefile:1100: vmlinux] Error 1
make[5]: Leaving directory '/media/SDStorage/builds/github-openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/linux-5$
make[4]: *** [Makefile:24: /media/SDStorage/builds/github-openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt7620/linux-5.$
make[4]: Leaving directory '/media/SDStorage/builds/github-openwrt/openwrt/target/linux/ramips'
make[3]: *** [Makefile:11: compile] Error 2
make[3]: Leaving directory '/media/SDStorage/builds/github-openwrt/openwrt/target/linux'
time: target/linux/compile#29.06#24.12#71.72
    ERROR: target/linux failed to build.
make[2]: *** [target/Makefile:25: target/linux/compile] Error 1
make[2]: Leaving directory '/media/SDStorage/builds/github-openwrt/openwrt'
make[1]: *** [target/Makefile:18: /media/SDStorage/builds/github-openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.target_compi$
make[1]: Leaving directory '/media/SDStorage/builds/github-openwrt/openwrt'
make: *** [/media/SDStorage/builds/github-openwrt/openwrt/include/toplevel.mk:230: world] Error 2
Command exited with non-zero status 2

Your toolchain is corrupted. To remove it, use make dirclean.

looking at toplevel.mk, it seems clean and dirclean is the same...

so it would be distclean right?

the same thing happened after distclean

The aren't the same.
Clean only cleans the build, but dirclean also cleans the toolchain and tools.

( distclean deletes also the downloaded source archives, which is really rarely needed...)

make dirclean and make distclean does not solve the problem

however I noticed this seems to happen when building for ramips
but building for ath79 is fine...