构建 v4l2loopback 时 make 出现问题

构建 v4l2loopback 时 make 出现问题

我试图通过简单地输入以下内容来构建 v4l2loopback:

制作

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

安装标题:

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

我还缺少什么?

答案1

/lib/modules/$(uname -r)/build不应该是目录,它应该是到 的符号链接/usr/src/linux-headers-$(uname -r)。如果你解决这个问题

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

你的构建应该可以工作。

相关内容