0

I'm trying to build v4l2loopback by simply entering:

make

Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/home/user/dev/labs/v4l2loopback modules
make[1]: Entering directory '/usr/lib/modules/5.13.0-22-generic/build'
make[1]: *** No rule to make target 'modules'.  Stop.
make[1]: Leaving directory '/usr/lib/modules/5.13.0-22-generic/build'
make: *** [Makefile:46: v4l2loopback.ko] Error 2

uname -r

5.13.0-22-generic

ls -l /usr/src/linux-headers-$(uname -r)

total 1772
drwxr-xr-x 3 root root    4096 Dec 20 00:26 arch
lrwxrwxrwx 1 root root      41 Nov  9 15:21 block -> ../linux-hwe-5.13-headers-5.13.0-22/block
lrwxrwxrwx 1 root root      41 Nov  9 15:21 certs -> ../linux-hwe-5.13-headers-5.13.0-22/certs
lrwxrwxrwx 1 root root      42 Nov  9 15:21 crypto -> ../linux-hwe-5.13-headers-5.13.0-22/crypto
lrwxrwxrwx 1 root root      49 Nov  9 15:21 Documentation -> ../linux-hwe-5.13-headers-5.13.0-22/Documentation
lrwxrwxrwx 1 root root      43 Nov  9 15:21 drivers -> ../linux-hwe-5.13-headers-5.13.0-22/drivers
lrwxrwxrwx 1 root root      38 Nov  9 15:21 fs -> ../linux-hwe-5.13-headers-5.13.0-22/fs
drwxr-xr-x 4 root root    4096 Dec 20 00:26 include
lrwxrwxrwx 1 root root      40 Nov  9 15:21 init -> ../linux-hwe-5.13-headers-5.13.0-22/init
lrwxrwxrwx 1 root root      39 Nov  9 15:21 ipc -> ../linux-hwe-5.13-headers-5.13.0-22/ipc
lrwxrwxrwx 1 root root      42 Nov  9 15:21 Kbuild -> ../linux-hwe-5.13-headers-5.13.0-22/Kbuild
lrwxrwxrwx 1 root root      43 Nov  9 15:21 Kconfig -> ../linux-hwe-5.13-headers-5.13.0-22/Kconfig
drwxr-xr-x 2 root root    4096 Dec 20 00:26 kernel
lrwxrwxrwx 1 root root      39 Nov  9 15:21 lib -> ../linux-hwe-5.13-headers-5.13.0-22/lib
lrwxrwxrwx 1 root root      44 Nov  9 15:21 Makefile -> ../linux-hwe-5.13-headers-5.13.0-22/Makefile
lrwxrwxrwx 1 root root      38 Nov  9 15:21 mm -> ../linux-hwe-5.13-headers-5.13.0-22/mm
-rw-r--r-- 1 root root 1783838 Nov  9 15:21 Module.symvers
lrwxrwxrwx 1 root root      39 Nov  9 15:21 net -> ../linux-hwe-5.13-headers-5.13.0-22/net
lrwxrwxrwx 1 root root      43 Nov  9 15:21 samples -> ../linux-hwe-5.13-headers-5.13.0-22/samples
drwxr-xr-x 7 root root   12288 Dec 20 00:26 scripts
lrwxrwxrwx 1 root root      44 Nov  9 15:21 security -> ../linux-hwe-5.13-headers-5.13.0-22/security
lrwxrwxrwx 1 root root      41 Nov  9 15:21 sound -> ../linux-hwe-5.13-headers-5.13.0-22/sound
drwxr-xr-x 4 root root    4096 Dec 20 00:26 tools
lrwxrwxrwx 1 root root      42 Nov  9 15:21 ubuntu -> ../linux-hwe-5.13-headers-5.13.0-22/ubuntu
lrwxrwxrwx 1 root root      39 Nov  9 15:21 usr -> ../linux-hwe-5.13-headers-5.13.0-22/usr
lrwxrwxrwx 1 root root      40 Nov  9 15:21 virt -> ../linux-hwe-5.13-headers-5.13.0-22/virt

Installed the headers with:

sudo apt install linux-headers-$(uname -r)

What else am I missing?

2
  • What does ls -ld /lib/modules/$(uname -r)/build show? Dec 20, 2021 at 10:45
  • @StephenKitt it gives drwxr-xr-x 2 root root 4096 Dec 20 00:32 /lib/modules/5.13.0-22-generic/build although this directory is empty.
    – valk
    Dec 20, 2021 at 10:48

1 Answer 1

1

/lib/modules/$(uname -r)/build isn’t supposed to be a directory, it’s supposed to be a symbolic link to /usr/src/linux-headers-$(uname -r). If you fix that with

sudo rmdir "/lib/modules/$(uname -r)/build"
sudo ln -s "/usr/src/linux-headers-$(uname -r)" "/lib/modules/$(uname -r)/build"

your build should work.

1
  • Thank you! Not sure how it got to that point after doing system update.
    – valk
    Dec 20, 2021 at 11:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .