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

名前なし -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"

ビルドが機能するはずです。

関連情報