m-tsudo / pt3

PT3のLinuxドライバ

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linux Kernel 6.4でビルドに失敗

asukuru-01234 opened this issue · comments

OS: Ubuntu 22.04
Kernel: 6.4.0-060400-generic
GCC: gcc version 12.1.0 (Ubuntu 12.1.0-2ubuntu1~22.04)

いつも大変お世話になっております。
Linux Kernel 6.3までは正常動作していたのですが、6.4に上げたところドライバのビルドに失敗しましたので報告させていただきます。ご迷惑をおかけしますがどうぞよろしくお願い致します。

  • dkms時のエラーログ
  • ビルド時のエラーログ
    双方を下記に添付しておりますのでどうぞよろしくお願い致します。

dkms時のエラー

./dkms.install
Deleting module pt3_drv-0.0.1 completely from the DKMS tree.
rm -vf /lib/modules/`uname -r`/kernel/drivers/video/pt3_drv.ko* /etc/udev/rules.d/99-pt3.rules
removed '/usr/src/pt3_drv-0.0.1/pt3_mx.h'
removed '/usr/src/pt3_drv-0.0.1/.pt3_bus.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/.modules.order.cmd'
removed '/usr/src/pt3_drv-0.0.1/Module.symvers'
removed '/usr/src/pt3_drv-0.0.1/pt3_qm.o'
removed '/usr/src/pt3_drv-0.0.1/.pt3_dma.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/pt3_i2c.c'
removed '/usr/src/pt3_drv-0.0.1/pt3_drv.ko'
removed '/usr/src/pt3_drv-0.0.1/pt3_tc.h'
removed '/usr/src/pt3_drv-0.0.1/.pt3_drv.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/.pt3_i2c.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/pt3_drv.o'
removed '/usr/src/pt3_drv-0.0.1/pt3_i2c.o'
removed '/usr/src/pt3_drv-0.0.1/pt3_dma.c'
removed '/usr/src/pt3_drv-0.0.1/pt3_com.h'
removed '/usr/src/pt3_drv-0.0.1/pt3_bus.h'
removed '/usr/src/pt3_drv-0.0.1/pt3_tc.c'
removed '/usr/src/pt3_drv-0.0.1/dkms.conf'
removed '/usr/src/pt3_drv-0.0.1/pt3_i2c.h'
removed '/usr/src/pt3_drv-0.0.1/pt3_dma.o'
removed '/usr/src/pt3_drv-0.0.1/pt3_qm.h'
removed '/usr/src/pt3_drv-0.0.1/.pt3_drv.mod.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/.pt3_mx.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/pt3_qm.c'
removed '/usr/src/pt3_drv-0.0.1/pt3_bus.c'
removed '/usr/src/pt3_drv-0.0.1/.pt3_drv.ko.cmd'
removed '/usr/src/pt3_drv-0.0.1/.pt3_pci.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/.gitignore'
removed '/usr/src/pt3_drv-0.0.1/pt3_drv.mod.c'
removed '/usr/src/pt3_drv-0.0.1/.pt3_qm.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/pt3_ioctl.h'
removed '/usr/src/pt3_drv-0.0.1/pt3_mx.o'
removed '/usr/src/pt3_drv-0.0.1/pt3_mx.c'
removed '/usr/src/pt3_drv-0.0.1/pt3_drv.mod.o'
removed '/usr/src/pt3_drv-0.0.1/pt3_pci.c'
removed '/usr/src/pt3_drv-0.0.1/Makefile'
removed '/usr/src/pt3_drv-0.0.1/.pt3_drv.mod.cmd'
removed '/usr/src/pt3_drv-0.0.1/pt3_pci.o'
removed '/usr/src/pt3_drv-0.0.1/pt3_pci.h'
removed '/usr/src/pt3_drv-0.0.1/pt3_tc.o'
removed '/usr/src/pt3_drv-0.0.1/.Module.symvers.cmd'
removed '/usr/src/pt3_drv-0.0.1/.pt3_tc.o.cmd'
removed '/usr/src/pt3_drv-0.0.1/COPYING'
removed '/usr/src/pt3_drv-0.0.1/td/.gitignore'
removed '/usr/src/pt3_drv-0.0.1/td/check_lfsr.c'
removed '/usr/src/pt3_drv-0.0.1/td/Makefile'
removed '/usr/src/pt3_drv-0.0.1/td/td.c'
removed directory '/usr/src/pt3_drv-0.0.1/td'
removed '/usr/src/pt3_drv-0.0.1/pt3_bus.o'
removed '/usr/src/pt3_drv-0.0.1/modules.order'
removed '/usr/src/pt3_drv-0.0.1/dkms.uninstall'
removed '/usr/src/pt3_drv-0.0.1/version.h'
removed '/usr/src/pt3_drv-0.0.1/dkms.install'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/prepare-commit-msg.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/update.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/push-to-checkout.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/pre-push.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/pre-applypatch.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/applypatch-msg.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/pre-receive.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/pre-commit.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/pre-merge-commit.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/fsmonitor-watchman.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/commit-msg.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/pre-rebase.sample'
removed '/usr/src/pt3_drv-0.0.1/.git/hooks/post-update.sample'
removed directory '/usr/src/pt3_drv-0.0.1/.git/hooks'
removed directory '/usr/src/pt3_drv-0.0.1/.git/objects/info'
removed '/usr/src/pt3_drv-0.0.1/.git/objects/pack/pack-74a2bbe7e502032cbbc16ae0607eb906cb1d65ea.pack'
removed '/usr/src/pt3_drv-0.0.1/.git/objects/pack/pack-74a2bbe7e502032cbbc16ae0607eb906cb1d65ea.idx'
removed directory '/usr/src/pt3_drv-0.0.1/.git/objects/pack'
removed directory '/usr/src/pt3_drv-0.0.1/.git/objects'
removed '/usr/src/pt3_drv-0.0.1/.git/HEAD'
removed '/usr/src/pt3_drv-0.0.1/.git/packed-refs'
removed directory '/usr/src/pt3_drv-0.0.1/.git/branches'
removed '/usr/src/pt3_drv-0.0.1/.git/FETCH_HEAD'
removed '/usr/src/pt3_drv-0.0.1/.git/description'
removed '/usr/src/pt3_drv-0.0.1/.git/info/exclude'
removed directory '/usr/src/pt3_drv-0.0.1/.git/info'
removed '/usr/src/pt3_drv-0.0.1/.git/index'
removed '/usr/src/pt3_drv-0.0.1/.git/refs/remotes/origin/HEAD'
removed directory '/usr/src/pt3_drv-0.0.1/.git/refs/remotes/origin'
removed directory '/usr/src/pt3_drv-0.0.1/.git/refs/remotes'
removed '/usr/src/pt3_drv-0.0.1/.git/refs/heads/master'
removed directory '/usr/src/pt3_drv-0.0.1/.git/refs/heads'
removed directory '/usr/src/pt3_drv-0.0.1/.git/refs/tags'
removed directory '/usr/src/pt3_drv-0.0.1/.git/refs'
removed '/usr/src/pt3_drv-0.0.1/.git/config'
removed '/usr/src/pt3_drv-0.0.1/.git/ORIG_HEAD'
removed '/usr/src/pt3_drv-0.0.1/.git/logs/HEAD'
removed '/usr/src/pt3_drv-0.0.1/.git/logs/refs/remotes/origin/HEAD'
removed directory '/usr/src/pt3_drv-0.0.1/.git/logs/refs/remotes/origin'
removed directory '/usr/src/pt3_drv-0.0.1/.git/logs/refs/remotes'
removed '/usr/src/pt3_drv-0.0.1/.git/logs/refs/heads/master'
removed directory '/usr/src/pt3_drv-0.0.1/.git/logs/refs/heads'
removed directory '/usr/src/pt3_drv-0.0.1/.git/logs/refs'
removed directory '/usr/src/pt3_drv-0.0.1/.git/logs'
removed directory '/usr/src/pt3_drv-0.0.1/.git'
removed '/usr/src/pt3_drv-0.0.1/README'
removed '/usr/src/pt3_drv-0.0.1/pt3_drv.mod'
removed '/usr/src/pt3_drv-0.0.1/pt3_dma.h'
removed '/usr/src/pt3_drv-0.0.1/etc/99-pt3.rules'
removed directory '/usr/src/pt3_drv-0.0.1/etc'
removed directory '/usr/src/pt3_drv-0.0.1'
Creating symlink /var/lib/dkms/pt3_drv/0.0.1/source -> /usr/src/pt3_drv-0.0.1

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j12 KERNELRELEASE=6.4.0-060400-generic KVER=6.4.0-060400-generic dkms...(bad exit status: 2)
ERROR (dkms apport): binary package for pt3_drv: 0.0.1 not found
Error! Bad return status for module build on kernel: 6.4.0-060400-generic (x86_64)
Consult /var/lib/dkms/pt3_drv/0.0.1/build/make.log for more information.

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j12 KERNELRELEASE=6.4.0-060400-generic KVER=6.4.0-060400-generic dkms...(bad exit status: 2)
ERROR (dkms apport): binary package for pt3_drv: 0.0.1 not found
Error! Bad return status for module build on kernel: 6.4.0-060400-generic (x86_64)
Consult /var/lib/dkms/pt3_drv/0.0.1/build/make.log for more information.
root@master:/usr/local/src/pt3#

ビルドログ

cat /var/lib/dkms/pt3_drv/0.0.1/build/make.log
DKMS make.log for pt3_drv-0.0.1 for kernel 6.4.0-060400-generic (x86_64)
Fri Jun 30 11:37:26 AM JST 2023
eval `sed -e "s/\[0\]//" ./dkms.conf`; \
GREV=`git rev-list HEAD | wc -l 2> /dev/null`; \
if [ $GREV != 0 ] ; then \
        printf "#define DRV_VERSION \"${PACKAGE_VERSION}rev$GREV\"\n#define DRV_RELDATE \"`git show --date=short --format=%ad | sed -n '1p' 2> /dev/null`\"\n#define DRV_NAME \"${BUILT_MODULE_NAME}\"\n" > version.h; \
else \
        printf "#define DRV_VERSION \"${PACKAGE_VERSION}\"\n#define DRV_RELDATE \"$PACKAGE_RELDATE\"\n#define DRV_NAME \"${BUILT_MODULE_NAME}\"\n" > version.h; \
fi
make -C /lib/modules/6.4.0-060400-generic/build M=`pwd` V=0 modules
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '/usr/src/linux-headers-6.4.0-060400-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1) 12.3.0
  You are using:           gcc-12 (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
  CC [M]  /var/lib/dkms/pt3_drv/0.0.1/build/pt3_pci.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 ./include/linux/time.h:5,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:13,
                 from /var/lib/dkms/pt3_drv/0.0.1/build/pt3_pci.c:20:
/var/lib/dkms/pt3_drv/0.0.1/build/pt3_pci.c: In function ‘pt3_pci_init’:
./include/linux/export.h:27:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   27 | #define THIS_MODULE (&__this_module)
      |                     ~^~~~~~~~~~~~~~~
      |                      |
      |                      struct module *
/var/lib/dkms/pt3_drv/0.0.1/build/pt3_pci.c:1156:39: note: in expansion of macro ‘THIS_MODULE’
 1156 |         pt3video_class = class_create(THIS_MODULE, DRV_CLASS);
      |                                       ^~~~~~~~~~~
In file included from ./include/linux/device.h:31,
                 from ./include/linux/pci.h:37,
                 from /var/lib/dkms/pt3_drv/0.0.1/build/pt3_pci.c:23:
./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/pt3_drv/0.0.1/build/pt3_pci.c:1156:26: error: too many arguments to function ‘class_create’
 1156 |         pt3video_class = class_create(THIS_MODULE, DRV_CLASS);
      |                          ^~~~~~~~~~~~
./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]: *** [scripts/Makefile.build:252: /var/lib/dkms/pt3_drv/0.0.1/build/pt3_pci.o] Error 1
make[1]: *** [Makefile:2032: /var/lib/dkms/pt3_drv/0.0.1/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-6.4.0-060400-generic'
make: *** [Makefile:12: pt3_drv.ko] Error 2

対応してみました。
https://github.com/m-tsudo/pt3/tree/fix_compile_error_on_kernel-6.4
こちらのブランチを試してみてください。

問題ないようであればマージします。

バグってるみたいなのでお待ちください。

修正しました。

お忙しい中、すぐにご対応いただき誠にありがとうございました。
kernel 6.3.9
kernel 6.4.0
両方のバージョンでビルドが通ることが確認できました。
どうぞよろしくお願いいたします。