Bug: Kernel headers 6.6.58 on sdm845 Nethunter - build tools wrong architecture?

Hello Nethunter Team and Community,

I’m running into an issue on my sdm845 device with the 6.6.58-sdm845-nh kernel. I’m unable to build any external kernel modules.

When I try to run make against the kernel headers (make -C /lib/modules/.../build M=$PWD modules), it fails with errors like this:

make -j7 -C /lib/modules/6.6.58-sdm845-nh/build M=$PWD modules
make[1]: Entering directory '/usr/src/linux-headers-6.6.58-sdm845-nh'
... (compilation lines) ...
/bin/sh: 1: scripts/basic/fixdep: Exec format error
make[3]: *** [scripts/Makefile.build:...] Error 126
... (more errors) ...
make: *** [Makefile:...] Error 2

The key error is the “Exec format error” for scripts/basic/fixdep.

I checked the properties of this specific file in the kernel headers directory:

file /usr/src/linux-headers-6.6.58-sdm845-nh/scripts/basic/fixdep
/usr/src/linux-headers-6.6.58-sdm845-nh/scripts/basic/fixdep: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked ...

This output shows that the fixdep binary included in the linux-headers-6.6.58-sdm845-nh package is compiled for x86-64 (amd64).

My system, however, is running on aarch64 (ARM64).

It seems like the linux-headers-6.6.58-sdm845-nh package might have been incorrectly packaged with kernel build tools compiled for the wrong architecture.

Is this a known issue with the 6.6.58-sdm845-nh headers for aarch64? Is there a way to obtain headers for this kernel version that include the build tools compiled for the correct architecture?

Any guidance would be greatly appreciated. Thanks!