PETsys / sw_daq_tofpet2

TOFPET 2 data acquisition software
MIT License
7 stars 11 forks source link

error=incompatible-pointer-types #41

Open agscaneu opened 2 months ago

agscaneu commented 2 months ago
user@ubuntu:~/sw_daq_tofpet2/src/kernel$ make
make -C /lib/modules/5.15.0-119-generic/build M=/home/user/sw_daq_tofpet2/src/kernel  modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-119-generic'
  CC [M]  /home/user/sw_daq_tofpet2/src/kernel/psdaq.o
/home/user/sw_daq_tofpet2/src/kernel/psdaq.c: In function ‘psdaq_init’:
/home/user/sw_daq_tofpet2/src/kernel/psdaq.c:138:37: error: assignment to ‘int (*)(struct device *, struct kobj_uevent_env *)’ from incompatible pointer type ‘int (*)(const struct device *, struct kobj_uevent_env *)’ [-Werror=incompatible-pointer-types]
  138 |         psdaq_dev_class->dev_uevent = psdaq_dev_uevent;
      |                                     ^
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:297: /home/user/sw_daq_tofpet2/src/kernel/psdaq.o] Error 1
make[1]: *** [Makefile:1911: /home/user/sw_daq_tofpet2/src/kernel] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-119-generic'
make: *** [Makefile:10: all] Error 2
user@ubuntu:~/sw_daq_tofpet2/src/kernel$ uname --all
Linux ubuntu 5.15.0-119-generic #129-Ubuntu SMP Fri Aug 2 19:25:20 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
user@ubuntu:~/sw_daq_tofpet2/src/kernel$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
user@ubuntu:~/sw_daq_tofpet2/src/kernel$ git rev-parse --short HEAD
b7768c7
rbugalho commented 2 months ago

Which software version are you using? This should not happen with v2024.05.27 or later.

agscaneu commented 2 months ago
user@ubuntu:~/sw_daq_tofpet2/src/kernel$ git rev-parse --short HEAD
b7768c7

I used commit hash b7768c7, which still appears to be the current HEAD

rbugalho commented 1 month ago

It looks like you are using Ubuntu 22.04.4 but with an older kernel (same as 20.04.5 actually).

And on top of this it looks like this Ubuntu kernel reverted an API change.

Is support for Ubuntu 20.04 and/or the 5.15.0 kernel something you require? Otherwise I'd advise to upgrade to Ubuntu 22.04 and the 6.8.0 kernel where the driver compiles OK.

agscaneu commented 1 month ago

We don't have specific requirements for kernel version.

This is the kernel version currently:

uname --all
Linux ******* 6.5.0-18-generic #18~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb  7 11:40:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Could be that we can get away with kernel upgrade. We need to try this. If kernel version 6.8.0+ is a requirement it would be helpful if this documented in the readme.md

rbugalho commented 1 month ago

Hi,

Your first report showed a strange combination: Ubuntu 22.04.4 with 5.15.0 kernel when the standard kernel for 22.04.4 is 6.5.

Can you confirm whether our software works or not in Ubuntu 22.04.4 with kernel 6.5 ?

agscaneu commented 1 month ago

You are correct - my mistake. I was not using the same computer (Computer_1) for uname --all command, as I used for the initial report.

Computer_1 was a clean install from 45f873de9f8cb637345d6e66a583762730bbea30277ef7b32c9c3bd6700a32b2 *ubuntu-22.04.4-live-server-amd64.iso with updates disabled.

Computer_2 has had unattended updates.

Compiling b7768c7 on Ubuntu 22.04, against kernel v6.5 (Computer_2) appears to work:

cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

uname --all
Linux **** 6.5.0-18-generic #18~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb  7 11:40:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

~/sw_daq_tofpet2/src/kernel$ make
make -C /lib/modules/6.5.0-18-generic/build M=/home/user/sw_daq_tofpet2/src/kernel  modules
make[1]: Entering directory '/usr/src/linux-headers-6.5.0-18-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~22.04) 12.3.0
  You are using:           gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  CC [M]  /home/user/sw_daq_tofpet2/src/kernel/psdaq.o
  MODPOST /home/user/sw_daq_tofpet2/src/kernel/Module.symvers
  CC [M]  /home/user/sw_daq_tofpet2/src/kernel/psdaq.mod.o
  LD [M]  /home/user/sw_daq_tofpet2/src/kernel/psdaq.ko
  BTF [M] /home/user/sw_daq_tofpet2/src/kernel/psdaq.ko
Skipping BTF generation for /home/user/sw_daq_tofpet2/src/kernel/psdaq.ko due to unavailability of vmlinux
make[1]: Leaving directory '/usr/src/linux-headers-6.5.0-18-generic'

On Computer_2 we are using v2023.07.27 due to firmware compatibility and the kernel module build fails. This is kind of expected due to kernel api compat changes are not backported. This has contributed to the confusion I guess.

Could you state the minimum kernel version here so we can close this issue with some conclusion?

rbugalho commented 1 month ago

Hi,

sorry it took this long. We've realised that Ubuntu 22.04 server has a different kernel than Ubuntu 22.04 desktop.

We've patched our software accordingly.

Our software should (in theory) work with any kernel past 3.0 but long term releases sometimes bring back/forward API changes requiring specific patches.

Please try the latest commit (7e8f68d32c15cd1756b5d29ebdfc2a9db3d9800a) and confirm it works in your systems.

agscaneu commented 1 month ago

Kernel module in commit 7e8f68d now compiles on Ubuntu specified on the first post.