[TK1 - R21.3] Error while installing v4l2loopback-dkms from repo and from sources

Dear all,

I am not an expert in module compiling and installing modules but I need v4l2loopback installe on the Jetson TK1 for one of my projects. So I tryed to install v4l2loopback-dkms using:

sudo apt-get install v4l2loopback-dkms

But this fails with the following error:

...
The following NEW packages are going to be installed :
  v4l2loopback-dkms
...
Preparing to unpack .../v4l2loopback-dkms_0.8.0-1_all.deb ...
Unpacking v4l2loopback-dkms (0.8.0-1) ...
Configuring de v4l2loopback-dkms (0.8.0-1) ...
Loading new v4l2loopback-0.8.0 DKMS files...
First Installation: checking all kernels...
dpkg : Warning : bad syntax version " * - * ": the version number does not start with a digit
It is likely that 3.10.40-gc017b03 belongs to a chroot's host
Building initial module for 3.10.40-gc017b03
Error! Bad return status for module build on kernel: 3.10.40-gc017b03 (armv7l)
Consult /var/lib/dkms/v4l2loopback/0.8.0/build/make.log for more information.

and the log tells me

DKMS make.log for v4l2loopback-0.8.0 for kernel 3.10.40-gc017b03 (armv7l)
vendredi 12 juin 2015, 16:28:51 (UTC+0200)
Building v4l2-loopback driver...
make -C /lib/modules/3.10.40-gc017b03/build M=/var/lib/dkms/v4l2loopback/0.8.0/build modules
make[1]: Entering directory `/usr/src/linux-headers-3.10.40-gc017b03'
  CC [M]  /var/lib/dkms/v4l2loopback/0.8.0/build/v4l2loopback.o
/usr/src/linux-headers-3.10.40-gc017b03/scripts/recordmcount: 1: /usr/src/linux-headers-3.10.40-gc017b03/scripts/recordmcount: Syntax error: "(" unexpected
make[2]: *** [/var/lib/dkms/v4l2loopback/0.8.0/build/v4l2loopback.o] Error 2
make[1]: *** [_module_/var/lib/dkms/v4l2loopback/0.8.0/build] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.10.40-gc017b03'
make: *** [v4l2loopback.ko] Error 2

Obviously when I clone the module git repository and build the module from it I get tha same errors independently from the version I try to compile. so on a simple

make

I get:

Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/media/ubuntu/Dev_volume/GST_DEV/v4l2loopback modules
make[1]: Entering directory `/usr/src/linux-headers-3.10.40-gc017b03'
  CC [M]  /media/ubuntu/Dev_volume/GST_DEV/v4l2loopback/v4l2loopback.o
/usr/src/linux-headers-3.10.40-gc017b03/scripts/recordmcount: 1: /usr/src/linux-headers-3.10.40-gc017b03/scripts/recordmcount: Syntax error: "(" unexpected
make[2]: *** [/media/ubuntu/Dev_volume/GST_DEV/v4l2loopback/v4l2loopback.o] Error 2
make[1]: *** [_module_/media/ubuntu/Dev_volume/GST_DEV/v4l2loopback] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.10.40-gc017b03'
make: *** [v4l2loopback.ko] Error 2

I made the same on the thing on the host platform (ubuntu 14.04 with a kernel v3.18) and I have no problem at all (both with the package and from sources)

So the question is how can I solve this issue that is I think link to some thing wrong at the system level?

Best regards,
Olivier.

Is this still a problem?

What does this say?

file /usr/src/linux-headers-3.10.40-gc017b03/scripts/recordmcount

Greetings,

I am also seeing the same error when building a proprietary PCIe driver.

Running:

file /usr/src/linux-headers-3.10.40-gc017b03/scripts/recordmcount

Gives:

/usr/src/linux-headers-3.10.40-gc017b03/scripts/recordmcount: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=bd0ce06b07e0e8ad0bf82c6a306298cc8271d3cc, not stripped

Here is the uname from my Jetson:

Linux tegra-ubuntu 3.10.40-gc017b03 #1 SMP PREEMPT Mon Feb 2 17:50:48 PST 2015 armv7l armv7l armv7l GNU/Linux

We’re not able to get the linux-headers for 3.10.40-gc017b03. We thought maybe there is a header mismatch between the kernel version and the linux headers that are included with L4T. Any thoughts?

Thanks for your assistance.

Brian | Pro Code Works, Inc.

Looks like the recordmcount is an X86 binary for some reason, so you can’t run it on Jetson. Looks like a bug in the Linux for Tegra release scripts.

Cross-compiling kernel and its modules on x86 is relatively easy, so you can try that approach to get your driver compiled. If you have an Ubuntu running on a PC, you need to “apt-get install gcc-arm-linux-gnueabihf” and compile the kernel with something like “make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j$(nproc) zImage)”.

I’m happy to provide mode exact instructions, if needed.

I think that file is built during compile. Make mrproper and building it on either ARM or x86 should determine whether the file ends up x86 or ARM.

kulve, exact instructions would be awesome. I’ve seen this issue a few other places around the web and if we could point people to your instructions, it would save folks a lot of time.

However, for the distribution of this driver, the kernel on every TK1 using the device is going to have to be re-compiled?
Would subsequent revisions of L4T have this fixed if it prevents a kernel object from being built on the target? Seems pretty significant if modules aren’t getting cross-compiled.

Thanks again for the assist!

Seems that the issue is partly addressed in the latest release (21.4). You can fix the issue in there with:

$ cd /usr/src/linux-headers-3.10.40-gdacac96/
$ sudo make modules_prepare

Is upgrading to 21.4 an option for you?

Just upgraded, no issues. I’ll try those commands shortly. Thanks again!

The kernel object builds now! Now I have to debug a kernel pack upon insmod’ing the driver.
Thanks again kulve for sharing the knowledge!

The update to R21.4 is a nice solution and the additional workaround you propose (it is also proposed when you first try to build the module without preparing headers…) make it easy the build the module from source. It also helps dkms to build the module when you want to install it from repo with

sudo apt-get install v4l2loopback-dkms

Best regards.