MiSTerArch / PKGBUILDs

Arch Linux ARM packages to run MiSTer
17 stars 1 forks source link

cannot use dkms to compile kernel modules #17

Open tcamargo opened 2 years ago

tcamargo commented 2 years ago

Trying to install aur/xone-dkms-git

$ sudo dkms build -m xone -v 0.2 -k 5.15.1/armv7l --kernelsourcedir /usr/lib/modules/5.15.1-6/build/

Building module:
cleaning build area...
make -j2 KERNELRELEASE=5.15.1 -C /usr/lib/modules/5.15.1-6/build/ M=/var/lib/dkms/xone/0.2/build...(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.15.1 (armv7l)
Consult /var/lib/dkms/xone/0.2/build/make.log for more information.
$ cat /var/lib/dkms/xone/0.2/build/make.log
DKMS make.log for xone-0.2 for kernel 5.15.1 (armv7l)
Mon May  2 15:58:21 UTC 2022
make: Entering directory '/usr/lib/modules/5.15.1-6/build'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (crosstool-NG 1.23.0.418-d590) 10.2.0
  You are using:           gcc (GCC) 11.2.0
  CC [M]  /var/lib/dkms/xone/0.2/build/transport/wired.o
  CC [M]  /var/lib/dkms/xone/0.2/build/transport/dongle.o
cc1: error: cannot load plugin ./scripts/gcc-plugins/arm_ssp_per_task_plugin.so: ./scripts/gcc-plugins/arm_ssp_per_task_plugin.so: wrong ELF class: ELFCLASS64
make[1]: *** [scripts/Makefile.build:277: /var/lib/dkms/xone/0.2/build/transport/wired.o] Error 1
make[1]: *** Waiting for unfinished jobs....
cc1: error: cannot load plugin ./scripts/gcc-plugins/arm_ssp_per_task_plugin.so: ./scripts/gcc-plugins/arm_ssp_per_task_plugin.so: wrong ELF class: ELFCLASS64
make[1]: *** [scripts/Makefile.build:277: /var/lib/dkms/xone/0.2/build/transport/dongle.o] Error 1
make: *** [Makefile:1868: /var/lib/dkms/xone/0.2/build] Error 2
make: Leaving directory '/usr/lib/modules/5.15.1-6/build'
amstan commented 2 years ago

I'm just going to throw https://www.kernel.org/doc/html/latest/kbuild/headers_install.html in here.

This is what's killing us:

ARCH indicates which architecture to produce headers for, and defaults to the current architecture.

One way to bypass this is to manually build the kernel makepkg on the mister itself. Might take forever though. You could speed it up by editing the makepkg to not compile anything but the headers (not sure what that flag is though, we don't use headers_install).

Anyway, i'll fix this at some point.

amstan commented 2 years ago

Ok, let's rewind.

The way I see it there's 2 ways to fix this bug:

tcamargo commented 2 years ago

I think GCC plugins are tied to your host compiler. I don't know if there is a standard way to compile plugins for the target archicteture.

Anyway, a third option:

tcamargo commented 2 years ago

Fouth option:

tcamargo commented 2 years ago

CONFIG_GCC_PLUGIN_ARM_SSP_PER_TASK is the only plugin enabled by default. I did some research and it seems related to stack overflow proction on ARM: https://lwn.net/Articles/770984/. Not a deal breaker IMHO.

ArchlinuxARM enables GCC plugins support, but none is enabled: https://archlinuxarm.org/packages/armv7h/linux-armv7-headers/files/config.

amstan commented 2 years ago

Ok, so are you saying disabling that CONFIG is all that's needed? That seems easy. Have you tested it?