lg4k-linux icon indicating copy to clipboard operation
lg4k-linux copied to clipboard

Won't compile on Ubuntu 20.10

Open raleighlittles opened this issue 5 years ago • 1 comments

Tried compiling on both the master and fedora branch (as suggested in the README) and neither worked.

I'm on Ubuntu 20.10 with the 5.8.0-34-generic kernel.

Error messages

On master, I get this error message:

/home/raleigh/Avermedia/lg4k-linux/driver//utils/misc/sys.c: In function ‘sys_gettimestamp’:
/home/raleigh/Avermedia/lg4k-linux/driver//utils/misc/sys.c:90:21: error: storage size of ‘ts’ isn’t known
   90 |     struct timespec ts;
      |                     ^~
/home/raleigh/Avermedia/lg4k-linux/driver//utils/misc/sys.c:93:5: error: implicit declaration of function ‘ktime_get_ts’; did you mean ‘ktime_get_ns’? [-Werror=implicit-function-declaration]
   93 |     ktime_get_ts(&ts);
      |     ^~~~~~~~~~~~
      |     ktime_get_ns
/home/raleigh/Avermedia/lg4k-linux/driver//utils/misc/sys.c:90:21: warning: unused variable ‘ts’ [-Wunused-variable]
   90 |     struct timespec ts;
      |                     ^~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:290: /home/raleigh/Avermedia/lg4k-linux/driver//utils/misc/sys.o] Error 1
make[1]: *** [Makefile:1780: /home/raleigh/Avermedia/lg4k-linux/driver/] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-34-generic'
make: *** [Makefile:60: build] Error 2
make: Leaving directory '/home/raleigh/Avermedia/lg4k-linux/driver'
cp: cannot stat 'driver/cx511h.ko': No such file or directory

On fedora, I get this error message:

/home/raleigh/Avermedia/lg4k-linux/driver//utils/v4l2/v4l2_model_device.c: In function ‘v4l2_model_init’:
/home/raleigh/Avermedia/lg4k-linux/driver//utils/v4l2/v4l2_model_device.c:149:25: error: ‘VFL_TYPE_GRABBER’ undeclared (first use in this function); did you mean ‘VFL_TYPE_SUBDEV’?
  149 |            devicetype = VFL_TYPE_GRABBER;
      |                         ^~~~~~~~~~~~~~~~
      |                         VFL_TYPE_SUBDEV
/home/raleigh/Avermedia/lg4k-linux/driver//utils/v4l2/v4l2_model_device.c:149:25: note: each undeclared identifier is reported only once for each function it appears in
/home/raleigh/Avermedia/lg4k-linux/driver//utils/v4l2/v4l2_model_device.c:212:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
  212 |      v4l2_model_vb2_release(context->vb2_context);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/raleigh/Avermedia/lg4k-linux/driver//utils/v4l2/v4l2_model_device.c:213:5: note: here
  213 |     case V4L2_MODEL_ERROR_VIDEO_BUF:
      |     ^~~~
/home/raleigh/Avermedia/lg4k-linux/driver//utils/v4l2/v4l2_model_device.c:214:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
  214 |      v4l2_device_unregister(&context->v4l2_dev);
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/raleigh/Avermedia/lg4k-linux/driver//utils/v4l2/v4l2_model_device.c:215:5: note: here
  215 |     case V4L2_MODEL_ERROR_REGISTER_V4L2:
      |     ^~~~
make[2]: *** [scripts/Makefile.build:290: /home/raleigh/Avermedia/lg4k-linux/driver//utils/v4l2/v4l2_model_device.o] Error 1
make[1]: *** [Makefile:1780: /home/raleigh/Avermedia/lg4k-linux/driver/] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-34-generic'
make: *** [Makefile:60: build] Error 2
make: Leaving directory '/home/raleigh/Avermedia/lg4k-linux/driver'
cp: cannot stat 'driver/cx511h.ko': No such file or directory

I tried changing "VFL_TYPE_GRABBER" to be "VFL_TYPE_VIDEO" as a result of the kernel change (see here: https://github.com/patjak/bcwc_pcie/commit/82626d4892eeb9eb704538bf0dc49a00725ff451) but that didn't work.

/home/raleigh/Avermedia/lg4k-linux/driver/include/it6664_IO.h:29:6: warning: "USING_1to8" is not defined, evaluates to 0 [-Wundef]
   29 | #if (USING_1to8==TRUE)
      |      ^~~~~~~~~~
  LD [M]  /home/raleigh/Avermedia/lg4k-linux/driver//cx511h.o
  MODPOST /home/raleigh/Avermedia/lg4k-linux/driver//Module.symvers
/home/raleigh/Avermedia/lg4k-linux/driver//.AverMediaLib_64.o.cmd: No such file or directory
make[2]: *** [scripts/Makefile.modpost:111: /home/raleigh/Avermedia/lg4k-linux/driver//Module.symvers] Error 1
make[1]: *** [Makefile:1693: modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-34-generic'
make: *** [Makefile:60: build] Error 2
make: Leaving directory '/home/raleigh/Avermedia/lg4k-linux/driver'
cp: cannot stat 'driver/cx511h.ko': No such file or directory

raleighlittles avatar Jan 08 '21 23:01 raleighlittles

I found a possible solution.

Change timespec to timespec64 and ktime_get_ts to ktime_get_ts64

lg4k-linux/driver/utils/misc/sys.c:90

unsigned long long sys_gettimestamp() { struct timespec64 ts; unsigned long long timestamp;

ktime_get_ts64(&ts);
timestamp=ts.tv_sec ;
timestamp*=1000000000;
timestamp+=ts.tv_nsec;

return timestamp;

}

Change VFL_TYPE_GRABBER to VFL_TYPE_VIDEO https://github.com/torvalds/linux/commit/70cad4495a7438b07d806b8795ab6c6ef083b737

lg4k-linux/driver/utils/v4l2/v4l2_model_device.c:149 case DEVICE_TYPE_GRABBER: devicetype = VFL_TYPE_VIDEO; break;

Add a line to build.sh: touch ./driver/.AverMediaLib_64.o.cmd

lg4k-linux/build.sh #!/bin/sh make -C driver clean touch ./driver/.AverMediaLib_64.o.cmd make -C driver cp driver/cx511h.ko ./

I don't have that capture card so I couldn't test the driver. But maybe it works.

honkaadam avatar Nov 12 '21 20:11 honkaadam