gotzl / hid-fanatecff

Driver to support FANATEC input devices, in particular ForceFeedback of various wheel-bases
GNU General Public License v2.0
151 stars 19 forks source link

Compilation errors on NixOS #50

Closed PhilT closed 7 months ago

PhilT commented 7 months ago

I'm trying to build this on NixOS and getting the following errors. Is the next branch compiling for others at the moment? Just want to check before I dive into to figuring out the problem:

build flags: SHELL=/nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash KVERSION=6.1.65 KDIR=/nix/store/742mzxqii65p20l30bcbjaa49q88qs1m-linux-6.1.65-dev/lib/modules/6.1.65/build MODULEDIR=\$\(out\)

:: Compiling Fanatec kernel module
========================================
make -C /nix/store/742mzxqii65p20l30bcbjaa49q88qs1m-linux-6.1.65-dev/lib/modules/6.1.65/build M=$PWD
  CC [M]  /build/source/hid-ftec.o
  CC [M]  /build/source/hid-ftecff.o
/build/source/hid-ftecff.c: In function 'ftec_set_display':
/build/source/hid-ftecff.c:372:9: warning: ISO C90 forbids mixed declarations and code [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wdeclaration-after-statement-Wdeclaration-after-statement8;;]
  372 |         int bufIndex = 0;
      |         ^~~
/build/source/hid-ftecff.c: In function 'ftec_init_led':
/build/source/hid-ftecff.c:713:17: error: 'struct ftec_drv_data' has no member named 'led_state'
  713 |         drv_data->led_state = 0;
      |                 ^~
/build/source/hid-ftecff.c:715:25: error: 'struct ftec_drv_data' has no member named 'led'
  715 |                 drv_data->led[j] = NULL;
      |                         ^~
/build/source/hid-ftecff.c:731:39: error: 'ftec_led_get_brightness' undeclared (first use in this function); did you mean 'led_set_brightness'?
  731 |                 led->brightness_get = ftec_led_get_brightness;
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~
      |                                       led_set_brightness
/build/source/hid-ftecff.c:731:39: note: each undeclared identifier is reported only once for each function it appears in
/build/source/hid-ftecff.c:732:39: error: 'ftec_led_set_brightness' undeclared (first use in this function); did you mean 'led_set_brightness'?
  732 |                 led->brightness_set = ftec_led_set_brightness;
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~
      |                                       led_set_brightness
/build/source/hid-ftecff.c:734:25: error: 'struct ftec_drv_data' has no member named 'led'
  734 |                 drv_data->led[j] = led;
      |                         ^~
/build/source/hid-ftecff.c:742:47: error: 'struct ftec_drv_data' has no member named 'led'
  742 |                                 led = drv_data->led[j];
      |                                               ^~
/build/source/hid-ftecff.c:743:41: error: 'struct ftec_drv_data' has no member named 'led'
  743 |                                 drv_data->led[j] = NULL;
      |                                         ^~
/build/source/hid-ftecff.c: At top level:
/build/source/hid-ftecff.c:683:12: warning: 'ftec_init_led' defined but not used [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wunused-function-Wunused-function8;;]
  683 | static int ftec_init_led(struct hid_device *hid) {
      |            ^~~~~~~~~~~~~
make[2]: *** [/nix/store/742mzxqii65p20l30bcbjaa49q88qs1m-linux-6.1.65-dev/lib/modules/6.1.65/source/scripts/Makefile.build:250: /build/source/hid-ftecff.o] Error 1
make[1]: *** [/nix/store/742mzxqii65p20l30bcbjaa49q88qs1m-linux-6.1.65-dev/lib/modules/6.1.65/source/Makefile:2014: /build/source] Error 2
make: *** [Makefile:8: default] Error 2
error: builder for '/nix/store/d19zllji2zzmrbcqyzfqcgxljhad0zan-hid-fanatecff.drv' failed with exit code 2

Thanks.

gotzl commented 7 months ago

Hi, you are right, there seems to be a build issue when compiling without CONFIG_LEDS_CLASS set in the kernel config. I've just submitted a potential fix for that, pleas try it out. Ty!

PhilT commented 7 months ago

Thanks @gotzl! Yep, that's building now.