Error building DKMS module for kernel 6.4.0-rc1 kvmfr/0.0.8
endre-szabo-dev opened this issue · comments
On Arch Linux when upgrading the mainline kernel I saw the following error.
Install DKMS modules
==> dkms install --no-depmod kvmfr/0.0.8 -k 6.4.0-rc1-1-mainline
Error! Bad return status for module build on kernel: 6.4.0-rc1-1-mainline (x86_64)
Consult /var/lib/dkms/kvmfr/0.0.8/build/make.log for more information.
==> WARNING: `dkms install --no-depmod kvmfr/0.0.8 -k 6.4.0-rc1-1-mainline' exited 10
/var/lib/dkms/kvmfr/0.0.8/build/make.log
1 │ DKMS make.log for kvmfr-0.0.8 for kernel 6.4.0-rc1-1-mainline (x86_64)
2 │ Wed May 10 08:32:48 PM EEST 2023
3 │ make -C /usr/lib/modules/6.4.0-rc1-1-mainline/build M=/var/lib/dkms/kvmfr/0.0.8/build modules
4 │ CC [M] /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.o
5 │ In file included from ./include/linux/linkage.h:7,
6 │ from ./arch/x86/include/asm/cache.h:5,
7 │ from ./include/linux/cache.h:6,
8 │ from ./arch/x86/include/asm/current.h:9,
9 │ from ./include/linux/sched.h:12,
10 │ from ./include/linux/ratelimit.h:6,
11 │ from ./include/linux/dev_printk.h:16,
12 │ from ./include/linux/device.h:15,
13 │ from /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.c:24:
14 │ /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.c: In function ‘kvmfr_module_init’:
15 │ ./include/linux/export.h:27:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
16 │ 27 | #define THIS_MODULE (&__this_module)
17 │ | ~^~~~~~~~~~~~~~~
18 │ | |
19 │ | struct module *
20 │ /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.c:542:32: note: in expansion of macro ‘THIS_MODULE’
21 │ 542 | kvmfr->pClass = class_create(THIS_MODULE, KVMFR_DEV_NAME);
22 │ | ^~~~~~~~~~~
23 │ In file included from ./include/linux/device.h:31:
24 │ ./include/linux/device/class.h:229:54: note: expected ‘const char *’ but argument is of type ‘struct module *’
25 │ 229 | struct class * __must_check class_create(const char *name);
26 │ | ~~~~~~~~~~~~^~~~
27 │ /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.c:542:19: error: too many arguments to function ‘class_create’
28 │ 542 | kvmfr->pClass = class_create(THIS_MODULE, KVMFR_DEV_NAME);
29 │ | ^~~~~~~~~~~~
30 │ ./include/linux/device/class.h:229:29: note: declared here
31 │ 229 | struct class * __must_check class_create(const char *name);
32 │ | ^~~~~~~~~~~~
33 │ cc1: some warnings being treated as errors
34 │ make[2]: *** [scripts/Makefile.build:252: /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.o] Error 1
35 │ make[1]: *** [Makefile:2026: /var/lib/dkms/kvmfr/0.0.8/build] Error 2
36 │ make: *** [Makefile:7: all] Error 2
If I'm reading the commit right it looks like we can just remove the parameter conditionally since its unused by the call according to torvalds/linux@dcfbb67. Will take a closer look later.
@endre-szabo-dev Please try this patch and see if the module builds and works fine for you. If it works fine I'll go ahead and proceed with PR #1076.
Unfortunately I don't have access to test myself as Gentoo does not provide a package for mainline Linux kernels.
Apply with patch -p1 < linux-64.patch.txt
Actually it looks like it isn't building as-is. Need to take a closer look at the changes it seems.
Take two; this builds fine for me but as mentioned I can't test readily as I don't have a box with 6.4 on it right now.
When I run make in the modules directory using your patch, I get the following error
make -C /lib/modules/6.4.0-rc1-1-mainline/build M=/home/endre/Downloads/LookingGlass/module modules
CC [M] /home/endre/Downloads/LookingGlass/module/kvmfr.o
In file included from <command-line>:
././include/linux/kconfig.h:5:10: fatal error: generated/autoconf.h: No such file or directory
5 | #include <generated/autoconf.h>
| ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [scripts/Makefile.build:252: /home/endre/Downloads/LookingGlass/module/kvmfr.o] Error 1
make[1]: *** [Makefile:2026: /home/endre/Downloads/LookingGlass/module] Error 2
make: *** [Makefile:7: all] Error 2
Is there anything else that I need to do differently?
Please note that 6.4 is a release candidate still, we will not accept any patches to fix a build against a non-release kernel version.
gnif: Sure, I wouldn't expect the ABI to change given that the merge window is closed now but understand the hesitation. I'll keep the PR as a draft for now in case others need it and reopen it once 6.4 is marked stable.
endre-szabo-dev: That file should be at /usr/lib/modules/6.4.0-rc1-1-mainline/build/include/generated/autoconf.h. Did you remember to install linux-mainline-headers?
I managed to resolve the issue on my system by recompiling the kernel, which fixed the missing autoconf.h
error.
@esibun I'm happy to report that with the patch, everything is working. Thank you for your effort.
Additionally, I'd like to mention that the patch came as a pleasant surprise because I wasn't anticipating it until version 6.4 is stable.
6.4 is officially released and I'm also tripped on this during NixOS update.
cc nixpkgs maintainer @alexbakker @babbaj @j-brn
Not sure if related. But this started today after updating NixOS
last 10 log lines:
> /build/source/module/kvmfr.c:542:19: error: too many arguments to function 'class_create'
> 542 | kvmfr->pClass = class_create(THIS_MODULE, KVMFR_DEV_NAME);
> | ^~~~~~~~~~~~
> /nix/store/63mjfb64xmr17k78yx7ryf1jmp312k0m-linux-6.4.3-dev/lib/modules/6.4.3/source/include/linux/device/class.h:230:29: note: declared here
> 230 | struct class * __must_check class_create(const char *name);
> | ^~~~~~~~~~~~
> cc1: some warnings being treated as errors
> make[2]: *** [/nix/store/63mjfb64xmr17k78yx7ryf1jmp312k0m-linux-6.4.3-dev/lib/modules/6.4.3/source/scripts/Makefile.build:252: /build/source/module/kvmfr.o] Error 1
> make[1]: *** [/nix/store/63mjfb64xmr17k78yx7ryf1jmp312k0m-linux-6.4.3-dev/lib/modules/6.4.3/source/Makefile:2026: /build/source/module] Error 2
> make: *** [Makefile:7: all] Error 2
For full logs, run 'nix log /nix/store/p1sksmj3b0asid0cp5a9psbs0rbpj209-kvmfr-B6.drv'.```
@iggut You'll need to run bleeding edge in order to run LG on kernel 6.4; the current beta release is incompatible until a new one is made.
@iggut the fix is included in nixos-unstable
channel: NixOS/nixpkgs#243016
Since kernel module is connected to the kernel package, in your /etc/nixos/configuration.nix
you need to set boot.kernelPackages = pkgs.unstable.linuxPackages_latest;
in order for boot.extraModulePackages
to use kvmfr
from the unstable channel.
I had the same issue which is mentioned by @endre-szabo-dev.
I have Arch linux with kernel: 6.6.9-zen1-1-zen
Here is the make log:
make.log
DKMS make.log for kvmfr-0.0.8 for kernel 6.6.9-zen1-1-zen (x86_64) Sat Jan 6 12:25:18 PM CET 2024 make -C /usr/lib/modules/6.6.9-zen1-1-zen/build M=/var/lib/dkms/kvmfr/0.0.8/build modules make[1]: Entering directory '/usr/lib/modules/6.6.9-zen1-1-zen/build' CC [M] /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.o In file included from ./include/linux/linkage.h:7, from ./arch/x86/include/asm/cache.h:5, from ./include/linux/cache.h:6, from ./arch/x86/include/asm/current.h:9, from ./include/linux/sched.h:12, from ./include/linux/ratelimit.h:6, from ./include/linux/dev_printk.h:16, from ./include/linux/device.h:15, from /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.c:24: /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.c: In function ‘kvmfr_module_init’: ./include/linux/export.h:29:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types] 29 | #define THIS_MODULE (&__this_module) | ~^~~~~~~~~~~~~~~ | | | struct module * /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.c:542:32: note: in expansion of macro ‘THIS_MODULE’ 542 | kvmfr->pClass = class_create(THIS_MODULE, KVMFR_DEV_NAME); | ^~~~~~~~~~~ In file included from ./include/linux/device.h:31: ./include/linux/device/class.h:230:54: note: expected ‘const char *’ but argument is of type ‘struct module *’ 230 | struct class * __must_check class_create(const char *name); | ~~~~~~~~~~~~^~~~ /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.c:542:19: error: too many arguments to function ‘class_create’ 542 | kvmfr->pClass = class_create(THIS_MODULE, KVMFR_DEV_NAME); | ^~~~~~~~~~~~ ./include/linux/device/class.h:230:29: note: declared here 230 | struct class * __must_check class_create(const char *name); | ^~~~~~~~~~~~ cc1: some warnings being treated as errors make[3]: *** [scripts/Makefile.build:243: /var/lib/dkms/kvmfr/0.0.8/build/kvmfr.o] Error 1 make[2]: *** [/usr/lib/modules/6.6.9-zen1-1-zen/build/Makefile:1911: /var/lib/dkms/kvmfr/0.0.8/build] Error 2 make[1]: *** [Makefile:234: __sub-make] Error 2 make[1]: Leaving directory '/usr/lib/modules/6.6.9-zen1-1-zen/build' make: *** [Makefile:7: all] Error 2
Making the modificatin in the kvmfr.c file based on the following patch solved the problem.
Take two; this builds fine for me but as mentioned I can't test readily as I don't have a box with 6.4 on it right now.