umlaeute / v4l2loopback

v4l2-loopback device
GNU General Public License v2.0
3.69k stars 523 forks source link

Not buildable on i686 #550

Closed mikhailnov closed 6 months ago

mikhailnov commented 1 year ago

Latest HEAD - https://github.com/umlaeute/v4l2loopback/commit/9ba7e294ea6f45410a15f192381d4918e8df4f02 - is buildable on x86_64 and aarch64, but is not on i686 (x86_32):

ERROR: modpost: "__moddi3" [/root/v4l2loopback/v4l2loopback.ko] undefined!

I do not see where __moddi3 gets from.

Actually nobody is going to use it on i686, so it is not a big problem.

Bigger log:

# make V=1
Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/root/v4l2loopback KCPPFLAGS="" modules
make[1]: вход в каталог «/usr/src/linux-6.1.38-generic-1rosa2021.1-i686»
make -f ./scripts/Makefile.build obj=/root/v4l2loopback need-builtin=1 need-modorder=1 
  gcc -Wp,-MMD,/root/v4l2loopback/.v4l2loopback.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m32 -msoft-float -mregparm=3 -freg-struct-return -fno-pic -mpreferred-stack-boundary=2 -march=i686 -mtune=generic -Wa,-mtune=generic32 -ffreestanding -mstack-protector-guard-reg=fs -mstack-protector-guard-symbol=__stack_chk_guard -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -fzero-call-used-regs=used-gpr -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -gdwarf-4  -DMODULE  -DKBUILD_BASENAME='"v4l2loopback"' -DKBUILD_MODNAME='"v4l2loopback"' -D__KBUILD_MODNAME=kmod_v4l2loopback -c -o /root/v4l2loopback/v4l2loopback.o /root/v4l2loopback/v4l2loopback.c  
  ./scripts/check-local-export /root/v4l2loopback/v4l2loopback.o
  if nm /root/v4l2loopback/v4l2loopback.o 2>/dev/null | grep -q __ksymtab; then gcc -E -D__GENKSYMS__ -Wp,-MMD,/root/v4l2loopback/.v4l2loopback.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fcf-protection=none -m32 -msoft-float -mregparm=3 -freg-struct-return -fno-pic -mpreferred-stack-boundary=2 -march=i686 -mtune=generic -Wa,-mtune=generic32 -ffreestanding -mstack-protector-guard-reg=fs -mstack-protector-guard-symbol=__stack_chk_guard -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-stack-clash-protection -fzero-call-used-regs=used-gpr -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -g -gdwarf-4  -DMODULE  -DKBUILD_BASENAME='"v4l2loopback"' -DKBUILD_MODNAME='"v4l2loopback"' -D__KBUILD_MODNAME=kmod_v4l2loopback /root/v4l2loopback/v4l2loopback.c | scripts/genksyms/genksyms   -r /dev/null >> /root/v4l2loopback/.v4l2loopback.o.cmd; fi
  {   echo /root/v4l2loopback/v4l2loopback.ko; :; } > /root/v4l2loopback/modules.order
sh ./scripts/modules-check.sh /root/v4l2loopback/modules.order
make -f ./scripts/Makefile.modpost
   sed 's/ko$/o/'  /root/v4l2loopback/modules.order | scripts/mod/modpost -m -a    -o /root/v4l2loopback/Module.symvers -e -i Module.symvers -T - 
ERROR: modpost: "__moddi3" [/root/v4l2loopback/v4l2loopback.ko] undefined!

I'm not sure that the problem is in v4l2loopback.

mikhailnov commented 1 year ago

The latest commit on which a 32 bit kernel module for kernel 6.1 is buildable is b92e9ce7cccd30cd28743a3fe57eb7827909aeab

mikhailnov commented 1 year ago

So, commit 9f512816dfad3beb1d329bcb1d5955f6c5ddda99 broke 32 bit

pfactum commented 1 year ago

Does this:

diff --git a/drivers/media/v4l2-core/v4l2loopback.c b/drivers/media/v4l2-core/v4l2loopback.c
index 4659bdf7ebea..012bbcb11173 100644
--- a/drivers/media/v4l2-core/v4l2loopback.c
+++ b/drivers/media/v4l2-core/v4l2loopback.c
@@ -1541,7 +1541,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
 {
    struct v4l2_loopback_device *dev;
    struct v4l2_loopback_opener *opener;
-   int i;
+   int i, t;
    MARK();

    dev = v4l2loopback_getdevice(file);
@@ -1594,7 +1594,8 @@ static int vidioc_reqbufs(struct file *file, void *fh,

            /* after we update dev->used_buffers, buffers in outbufs_list will
             * correspond to dev->write_position + [0;b->count-1] range */
-           i = dev->write_position % b->count;
+           t = dev->write_position;
+           i = do_div(t, b->count);
            list_for_each_entry(pos, &dev->outbufs_list,
                        list_head) {
                dev->bufpos2index[i % b->count] =

fix the issue?

mikhailnov commented 1 year ago

No, it did not fix i686 builds

https://abf.io/build_lists/4681832 https://file-store.rosalinux.ru/api/v1/file_stores/7171b89d5a59138e3053993e5dc41928b58c60ce.log?show=true DEBUG: ERROR: modpost: "__moddi3" [/builddir/build/BUILD/v4l2loopback-9ba7e294ea6f45410a15f192381d4918e8df4f02/v4l2loopback.ko] undefined!

pfactum commented 1 year ago

Oh, sorry, I've just realised you are from Muscovy. Given you kill people in Ukraine, I'll not help you further.

Good luck.

mikhailnov commented 1 year ago

Буду рад Вашему возвращению в здравоумие, если это когда-нибудь случится 🙂

umlaeute commented 1 year ago

@pfactum please stop this. you are free to help or not help whomever you like, but please keep your reasons for yourself when you are posting on this issue tracker.

mikhailnov commented 6 months ago

Thanks for the fix.