Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DroidCam #1239

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft

Add DroidCam #1239

wants to merge 17 commits into from

Conversation

cycool29
Copy link
Contributor

@cycool29 cycool29 commented Dec 3, 2021

To close #851

@cycool29 cycool29 marked this pull request as draft December 3, 2021 13:36
@cycool29 cycool29 marked this pull request as ready for review December 20, 2021 06:27
@cycool29
Copy link
Contributor Author

This PR should be ready now, but I got ./include/linux/linkage.h:8:10: fatal error: asm/linkage.h: No such file or directory when installing DroidCam.

Does anyone get this message too?

@everypizza1
Copy link
Contributor

everypizza1 commented Dec 31, 2021

Droidcam works!

@Crilum
Copy link
Contributor

Crilum commented Dec 31, 2021

@cycool29, I think a How to run should be added to the DroidCam description, so users can know how to run it..

Also, the install scripts for DroidCam could be turned into one with a:

case $arch in
32) package_arch=armhf
64) package_arch=arm64
*) echo "Something is wrong!"

and then by putting the package_arch variable in the download link, for lib-jpeg-turbo.

Also, if the Github based release PR gets merged before this does, we'd want a version variable in the scripts.

Good work! 👍

apps/DDnet/description Outdated Show resolved Hide resolved
apps/DDnet/credits Outdated Show resolved Hide resolved
apps/DDnet/install Outdated Show resolved Hide resolved
@cycool29 cycool29 mentioned this pull request Jan 3, 2022
@cycool29
Copy link
Contributor Author

cycool29 commented Jan 3, 2022

Now I found DroidCam doesn't work on armhf architecture with arm64 kernel. Trying to fix it.

@cycool29 cycool29 marked this pull request as draft January 3, 2022 02:17
@cycool29 cycool29 marked this pull request as ready for review January 4, 2022 13:21
@everypizza1
Copy link
Contributor

everypizza1 commented Jan 8, 2022

when installing on twister OS, I got this error:

OS: Raspbian GNU/Linux 10 (buster)
OS architecture: 32-bit
Pi-Apps local commit ID: 6be5cfcbb5cbe0d7060fe70c75f3b0de797e4ebb
Github latest commit ID: 6be5cfcbb5cbe0d7060fe70c75f3b0de797e4ebb	
Kernel: armv7l 5.10.17-v7l+
Device model: Raspberry Pi 400 Rev 1.0
Ram size: 3.77 GB
Raspberry Pi OS image version: 2021-01-11
Language: en_US.UTF-8

BEGINNING OF LOG FILE:
-----------------------

Downloading Droid-Cam-RPi repository... Done
Downloading droidcam repository... Done
Will install these packages: http://ftp.us.debian.org/debian/pool/main/liba/libappindicator/libappindicator3-1_0.4.92-7_armhf.deb http://ftp.us.debian.org/debian/pool/main/liba/libappindicator/libappindicator3-dev_0.4.92-7_armhf.deb http://ftp.us.debian.org/debian/pool/main/liba/libappindicator/gir1.2-appindicator3-0.1_0.4.92-7_armhf.deb /home/pi/Droid-Cam-RPi/libjpeg-turbo_2.1.3_armhf.deb raspberrypi-kernel-headers libplist-dev libavutil-dev libswscale-dev libswscale-dev libspeex-dev libusbmuxd-dev libasound2-dev make gcc pkg-config libgtk-3-dev adb 
Downloading libappindicator3-1_0.4.92-7_armhf.deb... 
?25h
Done
Downloading libappindicator3-dev_0.4.92-7_armhf.deb... 
?25h
Done
Downloading gir1.2-appindicator3-0.1_0.4.92-7_armhf.deb... 
?25h
Done
Running sudo apt update...
Ign:1 file:/tmp/pi-apps-local-packages ./ InRelease
Ign:2 file:/tmp/pi-apps-local-packages ./ Release
Ign:3 file:/tmp/pi-apps-local-packages ./ Packages
Ign:4 file:/tmp/pi-apps-local-packages ./ Translation-en_US.UTF-8
Ign:5 file:/tmp/pi-apps-local-packages ./ Translation-en_US
Ign:6 file:/tmp/pi-apps-local-packages ./ Translation-en
Ign:3 file:/tmp/pi-apps-local-packages ./ Packages
Ign:4 file:/tmp/pi-apps-local-packages ./ Translation-en_US.UTF-8
Ign:5 file:/tmp/pi-apps-local-packages ./ Translation-en_US
Ign:6 file:/tmp/pi-apps-local-packages ./ Translation-en
Ign:3 file:/tmp/pi-apps-local-packages ./ Packages
Ign:4 file:/tmp/pi-apps-local-packages ./ Translation-en_US.UTF-8
Ign:5 file:/tmp/pi-apps-local-packages ./ Translation-en_US
Ign:6 file:/tmp/pi-apps-local-packages ./ Translation-en
Ign:3 file:/tmp/pi-apps-local-packages ./ Packages
Ign:4 file:/tmp/pi-apps-local-packages ./ Translation-en_US.UTF-8
Ign:5 file:/tmp/pi-apps-local-packages ./ Translation-en_US
Ign:6 file:/tmp/pi-apps-local-packages ./ Translation-en
Ign:3 file:/tmp/pi-apps-local-packages ./ Packages
Ign:4 file:/tmp/pi-apps-local-packages ./ Translation-en_US.UTF-8
Ign:5 file:/tmp/pi-apps-local-packages ./ Translation-en_US
Ign:6 file:/tmp/pi-apps-local-packages ./ Translation-en
Ign:3 file:/tmp/pi-apps-local-packages ./ Packages
Ign:4 file:/tmp/pi-apps-local-packages ./ Translation-en_US.UTF-8
Ign:5 file:/tmp/pi-apps-local-packages ./ Translation-en_US
Ign:6 file:/tmp/pi-apps-local-packages ./ Translation-en
Ign:4 file:/tmp/pi-apps-local-packages ./ Translation-en_US.UTF-8
Ign:5 file:/tmp/pi-apps-local-packages ./ Translation-en_US
Ign:6 file:/tmp/pi-apps-local-packages ./ Translation-en
Hit:7 http://archive.raspberrypi.org/debian buster InRelease
Hit:8 http://raspbian.raspberrypi.org/raspbian buster InRelease
121 packages can be upgraded. Run 'apt list --upgradable' to see them.
apt update complete.
Some packages can be upgraded. Please consider running sudo apt full-upgrade.
Creating an empty apt-package to install the necessary apt packages...
It will be named: pi-apps-45c61c0c
Depends: adb, gcc, gir1.2-appindicator3-0.1, libappindicator3-1, libappindicator3-dev, libasound2-dev, libavutil-dev, libgtk-3-dev, libjpeg-turbo, libplist-dev, libspeex-dev, libswscale-dev, libusbmuxd-dev, make, pkg-config, raspberrypi-kernel-headers
Installing the pi-apps-45c61c0c package...
The following additional packages will be installed:
  gir1.2-dbusmenu-glib-0.4 gir1.2-gtk-2.0 libappindicator3-dev
  libdbusmenu-glib-dev libgtk2.0-dev libjpeg-turbo libplist-dev libusbmuxd-dev
  libxml2-dev libxml2-utils raspberrypi-kernel-headers
Suggested packages:
  libgtk2.0-doc
The following NEW packages will be installed:
  gir1.2-dbusmenu-glib-0.4 gir1.2-gtk-2.0 libappindicator3-dev
  libdbusmenu-glib-dev libgtk2.0-dev libjpeg-turbo libplist-dev libusbmuxd-dev
  libxml2-dev libxml2-utils pi-apps-45c61c0c raspberrypi-kernel-headers
0 upgraded, 12 newly installed, 0 to remove and 121 not upgraded.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 153902 files and directories currently installed.)

Apt finished.
Package installation complete.
gcc  -Wall -O2 src/droidcam-cli.c src/connection.c src/settings.c src/decoder.c src/decoder_snd.c src/decoder_v4l2.c src/av.c src/usb.c src/queue.c -o droidcam-cli  -I/opt/libjpeg-turbo/include /opt/libjpeg-turbo/lib`getconf LONG_BIT`/libturbojpeg.a `pkg-config --libs --cflags libswscale libavutil` -lspeex -lasound -lpthread -lm -lusbmuxd
gcc  -Wall -O2 src/droidcam.c src/resources.c src/connection.c src/settings.c src/decoder.c src/decoder_snd.c src/decoder_v4l2.c src/av.c src/usb.c src/queue.c -o droidcam  `pkg-config --libs --cflags gtk+-3.0` `pkg-config --libs x11` `pkg-config --cflags --libs appindicator3-0.1` -I/opt/libjpeg-turbo/include /opt/libjpeg-turbo/lib`getconf LONG_BIT`/libturbojpeg.a `pkg-config --libs --cflags libswscale libavutil` -lspeex -lasound -lpthread -lm -lusbmuxd
src/droidcam.c: In function \u2018the_callback\u2019:
src/droidcam.c:276:4: warning: \u2018gtk_menu_popup\u2019 is deprecated: Use '(gtk_menu_popup_at_widget, gtk_menu_popup_at_pointer, gtk_menu_popup_at_rect)' instead [-Wdeprecated-declarations]
    gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, 0, 0);
    ^~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtklabel.h:34,
                 from /usr/include/gtk-3.0/gtk/gtkaccellabel.h:35,
                 from /usr/include/gtk-3.0/gtk/gtk.h:33,
                 from src/droidcam.c:9:
/usr/include/gtk-3.0/gtk/gtkmenu.h:138:9: note: declared here
 void    gtk_menu_popup    (GtkMenu        *menu,
         ^~~~~~~~~~~~~~
src/droidcam.c:281:4: warning: \u2018gtk_menu_popup\u2019 is deprecated: Use '(gtk_menu_popup_at_widget, gtk_menu_popup_at_pointer, gtk_menu_popup_at_rect)' instead [-Wdeprecated-declarations]
    gtk_menu_popup(GTK_MENU(wbMenu), NULL, NULL, NULL, NULL, 0, 0);
    ^~~~~~~~~~~~~~
In file included from /usr/include/gtk-3.0/gtk/gtklabel.h:34,
                 from /usr/include/gtk-3.0/gtk/gtkaccellabel.h:35,
                 from /usr/include/gtk-3.0/gtk/gtk.h:33,
                 from src/droidcam.c:9:
/usr/include/gtk-3.0/gtk/gtkmenu.h:138:9: note: declared here
 void    gtk_menu_popup    (GtkMenu        *menu,
         ^~~~~~~~~~~~~~
Copying files
+ cp uninstall /opt/droidcam-uninstall
+ cp icon2.png /opt/droidcam-icon.png
+ cp droidcam /usr/local/bin/
+ cp droidcam-cli /usr/local/bin/
+ set +x
Done
Webcam parameters: '640' and '480'
Building v4l2loopback-dc.ko
make: Entering directory '/home/pi/droidcam/v4l2loopback'
make -C /lib/modules/5.10.17-v7l+/build M=/home/pi/droidcam/v4l2loopback modules
make[1]: Entering directory '/home/pi/droidcam/v4l2loopback'
make[1]: *** /lib/modules/5.10.17-v7l+/build: No such file or directory.  Stop.
make[1]: Leaving directory '/home/pi/droidcam/v4l2loopback'
make: *** [Makefile:8: all] Error 2
make: Leaving directory '/home/pi/droidcam/v4l2loopback'
Failed to run install-video!

Failed to install DroidCam!
\u25e2\u25e3Need help? Copy the ENTIRE terminal output or take a screenshot.
Please ask on Github: https://github.com/Botspot/pi-apps/issues/new/choose
Or on Discord: https://discord.gg/RXSTvaUvuu

@cycool29
Copy link
Contributor Author

cycool29 commented Jan 8, 2022

Can you try to reboot and install again?

@everypizza1
Copy link
Contributor

everypizza1 commented Jan 8, 2022 via email

@cycool29
Copy link
Contributor Author

cycool29 commented Jan 8, 2022

Still doesn't work, I will just install Raspberry Pi OS for now.

Same error?

@cycool29
Copy link
Contributor Author

@derryktutt Any updates?

@everypizza1
Copy link
Contributor

everypizza1 commented Jan 12, 2022 via email

@cycool29
Copy link
Contributor Author

@derryktutt Can you post the output of: dpkg -L raspberrypi-kernel-headers | grep "/lib/modules"?

apps/DroidCam/install Outdated Show resolved Hide resolved
@cycool29
Copy link
Contributor Author

@derryktutt Can you post the output of: dpkg -L raspberrypi-kernel-headers | grep "/lib/modules"?

@derryktutt ^^

@everypizza1
Copy link
Contributor

everypizza1 commented Jan 28, 2022 via email

@Botspot
Copy link
Owner

Botspot commented Jan 28, 2022

I don't appear to have that package installed either.

$ dpkg -L raspberrypi-kernel-headers
dpkg-query: package 'raspberrypi-kernel-headers' is not installed
$ dpkg -S /lib/modules/*
raspberrypi-kernel: /lib/modules/5.10.92+
raspberrypi-kernel: /lib/modules/5.10.92-v7+
raspberrypi-kernel: /lib/modules/5.10.92-v7l+
raspberrypi-kernel: /lib/modules/5.10.92-v8+

@cycool29
Copy link
Contributor Author

dpkg-query: no packages found matching raspberrypi-kernel-headers

DroidCam needs kernel headers to work.
I've added a check in the install script to ask users to install linux-headers and reboot if not installed.

So, @derryktutt try sudo apt install linux-headers and reboot and install DroidCam again.

@cycool29
Copy link
Contributor Author

I don't appear to have that package installed either.

$ dpkg -L raspberrypi-kernel-headers
dpkg-query: package 'raspberrypi-kernel-headers' is not installed
$ dpkg -S /lib/modules/*
raspberrypi-kernel: /lib/modules/5.10.92+
raspberrypi-kernel: /lib/modules/5.10.92-v7+
raspberrypi-kernel: /lib/modules/5.10.92-v7l+
raspberrypi-kernel: /lib/modules/5.10.92-v8+

What I mean is raspberrypi-kernel-headers, not raspberrypi-kernel.

The output of dpkg -L raspberrypi-kernel-headers | grep "/lib/modules" on buster should be:

/lib/modules
/lib/modules/5.10.63+
/lib/modules/5.10.63-v7+
/lib/modules/5.10.63-v7l+
/lib/modules/5.10.63+/build
/lib/modules/5.10.63-v7+/build
/lib/modules/5.10.63-v7l+/build

@Botspot
Copy link
Owner

Botspot commented Feb 3, 2022

Correct, but only on Buster and lower. On Bullseye they've changed it up.

@cycool29
Copy link
Contributor Author

@Botspot This PR is ready to merge.

#check for 32 bit arch with 64 bit kernel
if [ "$(uname -m)" == "arm64" ] || [ "$(uname -m)" == "aarch64" ]; then
if [ "$(dpkg --print-architecture)" == "armhf" ]; then
warning "You can't install DroidCam on armhf OS with arm64 kernel."
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try my best to make arm64-kernel-on-armhf-OS an officially supported operating mode of Pi-Apps. Other apps like WPS Office need the arm64 kernel enabled, so it would be unfortunate for other apps to require the 64-bit kernel to not be enabled.

It should be possible to manually specify the desired architecture to those make commands.

Copy link
Contributor Author

@cycool29 cycool29 Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, I tried many times for this, all failed.

Tried:

  • Installing arm64 kernel
    • Result: I got my kernel messed up and I need to reflash my SD.
  • Change make to compile on armv7l kernel
    • Result: make prompts about a whole list of errors.
  • Use setarch and cross-compilation
    • Result: Same errors with compiling natively

Opened an issue on droidcam repo.

@theofficialgman theofficialgman changed the title Add DDnet and DroidCam Add DroidCam May 24, 2022
@theofficialgman theofficialgman marked this pull request as draft May 24, 2022 03:56
@theofficialgman
Copy link
Collaborator

theofficialgman commented Jan 7, 2023

I am new to this PR
is there are reason that v4l2loopback-dkms apt package can't be used instead of compiling the module in droidcam?
I know other users have used it with other software just fine

@theofficialgman
Copy link
Collaborator

yup the dkms module can be used
https://github.com/dev47apps/droidcam#v4l2-loopback-webcam-driver

Does anyone still run a 32bit OS with a 64bit kernel and is able to check if sudo apt install v4l2loopback-dkms succeeds without errors?

@Botspot
Copy link
Owner

Botspot commented Jan 7, 2023

Does anyone still run a 32bit OS with a 64bit kernel and is able to check if sudo apt install v4l2loopback-dkms succeeds without errors?

I do. This is the output:

$ sudo apt install v4l2loopback-dkms
sudo: unable to resolve host raspberrypi.cablelynx.com: Name or service not known
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  v4l2loopback-utils
The following NEW packages will be installed:
  v4l2loopback-dkms
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 36.2 kB of archives.
After this operation, 115 kB of additional disk space will be used.
Get:1 http://raspbian.mirror.axinja.net/raspbian bullseye/main armhf v4l2loopback-dkms all 0.12.5-1 [36.2 kB]
Fetched 36.2 kB in 1s (30.7 kB/s)            
Selecting previously unselected package v4l2loopback-dkms.
(Reading database ... 326841 files and directories currently installed.)
Preparing to unpack .../v4l2loopback-dkms_0.12.5-1_all.deb ...
Unpacking v4l2loopback-dkms (0.12.5-1) ...
Setting up v4l2loopback-dkms (0.12.5-1) ...
Loading new v4l2loopback-0.12.5 DKMS files...
It is likely that 5.15.76-v8+ belongs to a chroot's host
Building for 5.15.74-v7l+, 5.15.74-v8+, 5.15.76+, 5.15.76-v7+, 5.15.76-v7l+ and 5.15.76-v8+
Module build for kernel 5.15.74-v7l+ was skipped since the
kernel headers for this kernel does not seem to be installed.
Building initial module for 5.15.74-v8+
Error! Bad return status for module build on kernel: 5.15.74-v8+ (aarch64)
Consult /var/lib/dkms/v4l2loopback/0.12.5/build/make.log for more information.
dpkg: error processing package v4l2loopback-dkms (--configure):
 installed v4l2loopback-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 v4l2loopback-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

And here is the /var/lib/dkms/v4l2loopback/0.12.5/build/make.log file:
make.log

@theofficialgman
Copy link
Collaborator

theofficialgman commented Jan 7, 2023

yeah that error is because dkms is using the default armv7 gcc.
I don't think there is even an aaarch64 cross compiler available on armv7 host.

I think if you want to add droidcam, you will just have to accept that it can't be installed on systems that have a different kernel and userspace architecture.

@theofficialgman
Copy link
Collaborator

@Botspot I have recently become aware that raspbian packages non-standard aarch64 gcc crosscompilers for armhf hosts. This is interesting and not available in debian (only amd64, i386, and ppc64 have cross compilers for arm64 on debian).

Package: gcc-aarch64-linux-gnu
Source: gcc-defaults (1.203+rpi1)
Version: 4:12.2.0-3+rpi1
Architecture: armhf
Maintainer: Debian GCC Maintainers <[email protected]>
Installed-Size: 25
Depends: cpp-aarch64-linux-gnu (= 4:12.2.0-3+rpi1), gcc-12-aarch64-linux-gnu (>= 12.2.0-1~)
Recommends: libc6-dev-arm64-cross | libc-dev-arm64-cross
Suggests: make, manpages-dev, autoconf, automake, libtool, flex, bison, gdb-aarch64-linux-gnu, gcc-doc
Multi-Arch: foreign
Priority: optional
Section: devel
Filename: pool/main/g/gcc-defaults/gcc-aarch64-linux-gnu_12.2.0-3+rpi1_armhf.deb
Size: 1480
SHA256: 034790b101ebcb768f013b4f2dc3287b1bdee2a31d9e8be790fcc525c478bc70
SHA1: 72e485f8b45e6ae0874d3ede4c6bda5931eee127
MD5sum: a8a744f574b19da272ea07b224c50056
Description: GNU C compiler for the arm64 architecture
 This is the GNU C compiler, a fairly portable optimizing compiler for C.
 .
 This is a dependency package providing the default GNU C cross-compiler
 for the arm64 architecture.

so while the v4l2loopback-dkms likey can't be used directly due to missing compiler arguments, it should be possible to manually compile such as seen here https://forums.raspberrypi.com/viewtopic.php?t=349070#p2091642

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DroidCam
5 participants