intrepidcs / intrepid-socketcan-kernel-module

Kernel-mode SocketCAN module for Intrepid devices
17 stars 7 forks source link

Compilation error - Init from incompatible pointer type #1

Closed unprovable closed 6 years ago

unprovable commented 6 years ago

Hello!

So, I'm getting the following error when I try and make on Fedora 25 (uname -a data is Linux hostname 4.13.5-100.fc25.x86_64 #1 SMP Fri Oct 6 01:01:44 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux - in case it is of use)


$>make 
make -C /lib/modules/4.13.5-100.fc25.x86_64/build M=/home/mc/srlabs/research/ECU/intrepid-socketcan-kernel-module modules
make[1]: Entering directory '/usr/src/kernels/4.13.5-100.fc25.x86_64'
Makefile:940: "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
  CC [M]  /home/mc/srlabs/research/ECU/intrepid-socketcan-kernel-module/intrepid.o
/home/mc/srlabs/research/ECU/intrepid-socketcan-kernel-module/intrepid.c:501:27: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
         .fault          = intrepid_vm_fault
                           ^~~~~~~~~~~~~~~~~
/home/mc/srlabs/research/ECU/intrepid-socketcan-kernel-module/intrepid.c:501:27: note: (near initialization for ‘intrepid_vm_ops.fault’)
cc1: some warnings being treated as errors
scripts/Makefile.build:308: recipe for target '/home/mc/srlabs/research/ECU/intrepid-socketcan-kernel-module/intrepid.o' failed
make[2]: *** [/home/mc/srlabs/research/ECU/intrepid-socketcan-kernel-module/intrepid.o] Error 1
Makefile:1516: recipe for target '_module_/home/mc/srlabs/research/ECU/intrepid-socketcan-kernel-module' failed
make[1]: *** [_module_/home/mc/srlabs/research/ECU/intrepid-socketcan-kernel-module] Error 2
make[1]: Leaving directory '/usr/src/kernels/4.13.5-100.fc25.x86_64'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2```

**NB** - I've already edited the file to replace the destructors with `priv_destructor` at GCC's suggestion (it should be fine, I would think?) 

It seems that `.fault` (based off what I read in `/include/linux/mm.h`) needs it to be a `vm_fault` struct? but I'm not an expert on writing linux drivers, I'm afraid :P 

Many thanks for your time, M.