dev47apps / droidcam-linux-client

GNU/Linux/nix client for DroidCam
http://www.dev47apps.com
GNU General Public License v2.0
1.08k stars 174 forks source link

How to install DroidCam on `arm64` kernel with `armhf` OS? #218

Closed cycool29 closed 2 years ago

cycool29 commented 2 years ago

Describe the bug I tried to install droidcam on my Raspberry Pi armhf OS with arm64 kernel enabled. I got the following error when running sudo ./install-video:

Webcam parameters: '640' and '480'
Building v4l2loopback-dc.ko
make: Entering directory '/home/pi/droidcam/v4l2loopback'
make -C /lib/modules/5.10.92-v8+/build M=/home/pi/droidcam/v4l2loopback modules
make[1]: Entering directory '/usr/src/linux-headers-5.10.92-v8+'
arch/arm64/Makefile:25: ld does not support --fix-cortex-a53-843419; kernel may be susceptible to erratum
  CC [M]  /home/pi/droidcam/v4l2loopback/v4l2loopback-dc.o
gcc: error: unrecognized command-line option ‘-mbranch-protection=pac-ret+leaf+bti’
gcc: error: unrecognized command-line option ‘-mstack-protector-guard=sysreg’
gcc: error: unrecognized command-line option ‘-mstack-protector-guard-reg=sp_el0’
gcc: error: unrecognized command-line option ‘-mstack-protector-guard-offset=1376’
make[2]: *** [scripts/Makefile.build:280: /home/pi/droidcam/v4l2loopback/v4l2loopback-dc.o] Error 1
make[1]: *** [Makefile:1825: /home/pi/droidcam/v4l2loopback] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.10.92-v8+'
make: *** [Makefile:8: all] Error 2
make: Leaving directory '/home/pi/droidcam/v4l2loopback'

Expected behavior DroidCam installed as usual.

aramg commented 2 years ago

Unfortunately this is a linker (gcc / ld) issue. The Makefile (/usr/src/linux-headers-5.10.92-v8+/arch/arm64/Makefile) is part of your kernel headers and it doesn't work with the given gcc version. You can try updating gcc or ask the this particular distro/kernel maintainers.

Botspot commented 2 years ago

The OS is armhf, but the kernel is aarch64. @aramg, would there be a way to force the Makefile to compile a 32-bit build?

aramg commented 2 years ago

Not too sure how armhf/aarch64 coexsit, but the Makefile allows you to specify a KERNEL_DIR:

KERNEL_DIR=/lib/modules/?????/build make -C v4l2loopback

By default it was going into /lib/modules/5.10.92-v8+, maybe you have another option in /lib/modules/

cycool29 commented 2 years ago

Not too sure how armhf/aarch64 coexsit, but the Makefile allows you to specify a KERNEL_DIR:

KERNEL_DIR=/lib/modules/?????/build make -C v4l2loopback

By default it was going into /lib/modules/5.10.92-v8+, maybe you have another option in /lib/modules/

I did try that before, but I got a list of errors.

Here is the full output:

Webcam parameters: '640' and '480'
Building v4l2loopback-dc.ko
make: Entering directory '/home/pi/droidcam/v4l2loopback'
make -C /lib/modules//5.10.92-v7l+/build M=/home/pi/droidcam/v4l2loopback modules
make[1]: Entering directory '/usr/src/linux-headers-5.10.92-v7l+'
  CC [M]  /home/pi/droidcam/v4l2loopback/v4l2loopback-dc.o
In file included from ./include/asm/atomic.h:12,
                 from ./include/linux/atomic.h:7,
                 from ./include/asm-generic/bitops/lock.h:5,
                 from ./include/asm/bitops.h:32,
                 from ./include/linux/bitops.h:29,
                 from ./include/linux/kernel.h:12,
                 from ./include/linux/list.h:9,
                 from ./include/linux/preempt.h:11,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/vmalloc.h:5,
                 from /home/pi/droidcam/v4l2loopback/v4l2loopback-dc.c:24:
./include/asm/cmpxchg.h:11:2: error: #error "Cannot use generic cmpxchg on SMP"
   11 | #error "Cannot use generic cmpxchg on SMP"
      |  ^~~~~
[snip]
compilation terminated.
make[2]: *** [scripts/Makefile.build:280: /home/pi/droidcam/v4l2loopback/v4l2loopback-dc.o] Error 1
make[1]: *** [Makefile:1825: /home/pi/droidcam/v4l2loopback] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.10.92-v7l+'
make: *** [Makefile:8: all] Error 2
make: Leaving directory '/home/pi/droidcam/v4l2loopback'
aramg commented 2 years ago

The linux headers, regular headers, compiler all seem mis-matched. I am not sure what the fix is, sorry. This is on the distro/system, not a droidcam issue.

Botspot commented 2 years ago

Probably best to close this issue then. This is a matter of finding a way to compile a 64-bit kernel module on a 32-bit toolchain.