Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot use dkms to compile kernel modules #17

Open
tcamargo opened this issue May 2, 2022 · 6 comments
Open

cannot use dkms to compile kernel modules #17

tcamargo opened this issue May 2, 2022 · 6 comments

Comments

@tcamargo
Copy link
Contributor

tcamargo commented May 2, 2022

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
Copy link
Member

amstan commented May 2, 2022

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.

@tcamargo tcamargo mentioned this issue May 3, 2022
@amstan
Copy link
Member

amstan commented May 4, 2022

Ok, let's rewind.

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

  • Don't cross-compile. Obvious way. Makes stuff slower. It's an infrastructure/process changes (and for now that means my desktop and .zsh_history). If we choose to go this route there's not much you can do in a pull request for this. I do appreciate your eagerness here, but it's not helping yet.
  • Figure out a way for the cross-compiler to spew out the correct stuff anyway. I would highly prefer this option, since i get to keep everything else the same and keep the build speed high. There might be a way to upstream such a change too (archlinuxarm has pretty much the same PKGBUILD and they might appreciate this DKMS+cross-compiling ability too).

@tcamargo
Copy link
Contributor Author

tcamargo commented May 4, 2022

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:

  • Disable CONFIG_GCC_PLUGINS.

@tcamargo
Copy link
Contributor Author

tcamargo commented May 4, 2022

Fouth option:

  • Build linux-mister-headers inside chroot with make scripts. It would require a big change in current PKGBUILD.

@tcamargo
Copy link
Contributor Author

tcamargo commented May 4, 2022

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
Copy link
Member

amstan commented May 17, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants