Very new to Raspberry Pi & Linux programming, have only been tinkering with it for the past month, so assume I know nothing.
Context: I am using a custom 'lite' image from the Cluster Hat website on a pizero intended to be slotted into the HAT. The intent is to have 4 pizero's, each hooked up to a camera, and simultaneously capture 4 pictures of the same object, so it's important a camera is hooked up to each PiZero. In any case, the image provided was fairly out of date, and after updating everything, I attempted to run the libcamera-hello
command and ran into this error:
~ $ libcamera-hello --qt-preview
Preview window unavailable
[3:50:05.192541323] [19229] INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3866-0c55e522
[3:50:05.256764631] [19230] INFO RPI raspberrypi.cpp:1374 Registered camera /base/soc/i2c0mux/i2c@1/imx477@1a to Unicam device /dev/media3 and ISP device /dev/media0
[3:50:05.258008024] [19229] INFO Camera camera.cpp:1035 configuring streams: (0) 2028x1520-YUV420
[3:50:05.258793654] [19230] INFO RPI raspberrypi.cpp:761 Sensor: /base/soc/i2c0mux/i2c@1/imx477@1a - Selected sensor format: 2028x1520-SBGGR12_1X12 - Selected unicam format: 2028x1520-pBCC
[3:50:05.820926093] [19230] ERROR V4L2 v4l2_videodevice.cpp:1890 /dev/video14[15:cap]: Failed to start streaming: No such file or directory
ERROR: *** failed to start camera ***
I tried editing the boot file as well:
#Enable DRM VC4 V3D driver
dtoverlay=imx477 #this line was added by me
gpu_mem=256 #so was this line
dtoverlay=vc4-kms-v3d,cma-512
max_framebuffers=2
I again tried several variations of the command all of them had this result. After some searching around, some people mentioned an outdated or improper library, so I set about trying to re-build the libcamera
library. So, here are the commands I used to do so, following the instructions provided here:
~ $ git clone https://git.libcamera.org/libcamera/libcamera.git
~ $ sudo apt install meson ninja-build pkg-config
~ $ sudo apt install g++
~ $ sudo apt install clang
~ $ sudo apt install -C build install
~ $ sudo apt install libyaml-dev python3-yaml python3-ply python3-jinja2
~ $ sudo apt install libssl-dev openssl libdw-dev libunwind-dev libudev-dev
~ $ sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
~ $ sudo apt install libdrm-dev libjpeg libsdl2-dev
~ $ cd libcamera
~/libcamera $ meson build
~/libcamera $ ninja -C build install
It is worth noting the first time I ran that last command, I did not have have clang
installed or g++
(so I thought), and it stalled on [53/149]
for about 5 minutes. I cancelled it, and installed both g++
and clang
thinking this was the reason for it locking up. g++
showed up as being already installed. Now, when I run that last command, it stalls immediately:
$ ninja -C build install
ninja: Entering directory 'build'
[0/149] Compiling C++ object src/libca...ibcamera.so.0.0.0.p/bayer_format.cpp.o
And now when I run libcamera-hello
I am hit with ERROR: *** no cameras available ***
Most issues until now I was able to solve in an afternoon of googling, but this one is pretty out of my depth. Thank you for your time reading, and any help is appreciated :)
---UPDATE:---
First of all, fixed the "hang" in the build process by running ninja as ninja -C build install -j1
which restricts the number of parallel processes to 1 (i.e., one line at a time) ninja apparently has a habit of using system resources a lot - see here It slows the build to slightly more of a crawl, but at least it actually finishes this way instead of completely hanging up the system. Reminder I am running this on a Pi Zero W, so system resources are quite sparse - on a RPi 2/3/etc. or even a Pi Zero 2 you could probably get away with -j2
or even higher.
This surfaced a new issue with meson
which I fixed by installing meson/pip as root. this does require both meson build
and ninja -C build install -j1
to be run as sudo
So, the library builds but I am still stuck with ERROR: *** no cameras available ***
when I run libcamera-hello