Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 753860

Summary: media-video/v4l2loopback: build failed when build kernel out-of-tree
Product: Gentoo Linux Reporter: OwenJia <aptx945>
Component: Current packagesAssignee: Aaron W. Swenson <titanofold>
Status: UNCONFIRMED ---    
Severity: normal CC: jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description OwenJia 2020-11-10 14:47:09 UTC
i have a custom kernel build directory (for security reason), and using KERNEL_DIR refer to it, 

eg. KERNEL_DIR=/path/to/kernel_build

it's works fine for nvidia-drivers, but when i trying to install v4l2loopback, it just doesn't work.

the Makefile in the package:
```
KERNELRELEASE   ?= `uname -r`
KERNEL_DIR      ?= /lib/modules/$(KERNELRELEASE)/build

all: v4l2loopback.ko
v4l2loopback: v4l2loopback.ko
v4l2loopback.ko:
        @echo "Building v4l2-loopback driver..."
        $(MAKE) -C $(KERNEL_DIR) M=$(PWD) modules
```


here is the build.log i got:
```
 * v4l2loopback-0.12.5.tar.gz BLAKE2B SHA512 size ;-) ...                                                                       [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux-5.8.18-gentoo
 * Found kernel object directory:
 *     /path/to/kernel_build
 * Found sources for kernel version:
 *     5.8.18-gentoo
 * Checking for suitable kernel configuration options...                                                                        [ ok ]
>>> Unpacking source...
>>> Unpacking v4l2loopback-0.12.5.tar.gz to /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work
>>> Source unpacked in /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work
>>> Preparing source in /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5 ...
ln: failed to create symbolic link 'Module.symvers': File exists
 * Preparing v4l2loopback module
make -j9 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' all
Building v4l2-loopback driver...
make -C /usr/src/linux-5.8.18-gentoo M=/var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5 modules
make[1]: Entering directory '/usr/src/linux-5.8.18-gentoo'

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

make[1]: *** [Makefile:719: include/config/auto.conf] Error 1
make[1]: Leaving directory '/usr/src/linux-5.8.18-gentoo'
make: *** [Makefile:43: v4l2loopback.ko] Error 2
 * ERROR: media-video/v4l2loopback-0.12.5-r1::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=media-video/v4l2loopback-0.12.5-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=media-video/v4l2loopback-0.12.5-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5'
 * S: '/var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5'
```
Comment 1 OwenJia 2020-11-11 15:21:28 UTC
not sure why, but when i set KBUILD_OUTPUT to empty, it's compiled.

logs here:
```
KERNEL_DIR=/path/to/kernel_build KBUILD_OUTPUT= ebuild /usr/portage/media-video/v4l2loopback/v4l2loopback-0.12.5-r1.ebuild clean compile[0/48400]
 * v4l2loopback-0.12.5.tar.gz BLAKE2B SHA512 size ;-) ...                                                                       [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux-5.8.18-gentoo
 * Found kernel object directory:
 *     /path/to/kernel_build
 * Found sources for kernel version:
 *     5.8.18-gentoo
 * Checking for suitable kernel configuration options...                                                                        [ ok ]
>>> Unpacking source...
>>> Unpacking v4l2loopback-0.12.5.tar.gz to /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work
>>> Source unpacked in /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work
>>> Preparing source in /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5 ...
ln: failed to create symbolic link 'Module.symvers': File exists
 * Preparing v4l2loopback module
make -j9 HOSTCC=x86_64-pc-linux-gnu-gcc CROSS_COMPILE=x86_64-pc-linux-gnu- 'LDFLAGS=-m elf_x86_64' all 
Building v4l2-loopback driver...
make -C /usr/src/linux-5.8.18-gentoo M=/var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5 modules
make[1]: Entering directory '/usr/src/linux-5.8.18-gentoo'
make[2]: Entering directory '/path/to/kernel_build'
  CC [M]  /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5/v4l2loopback.o
  MODPOST /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5/Module.symvers
  CC [M]  /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5/v4l2loopback.mod.o
  LD [M]  /var/tmp/portage/media-video/v4l2loopback-0.12.5-r1/work/v4l2loopback-0.12.5/v4l2loopback.ko
make[2]: Leaving directory '/path/to/kernel_build'
make[1]: Leaving directory '/usr/src/linux-5.8.18-gentoo'
>>> Source compiled.
```