Error in building libcamera library on Raspberry Pi Bullseye - linux

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

Related

E: Unable to locate package arm-none-eabi-gcc

I'm working on a project in which I've to compile a MicroPython stack and build a firmware file for my STM32 boards. At present, I'm following through the instruction set given on https://docs.micropython.org/en/latest/develop/gettingstarted.html. Hence, to compile the code, I need an ARM cross-compiler (mentioned on the website). After entering the following command on the terminal "sudo apt-get install arm-none-eabi-gcc arm-none-eabi-binutils arm-none-eabi-newlib", I'm getting some errors (basically, unable to locate packages). I tried googling a lot but didn't come across any relevant links. Does anyone know what I need to do?
My pc configurations are AMD Ryzen 5 processor (IdeaPad 3 15ALC6), and I'm using Ubuntu 22.04.1 LTS OS. The snippet of the error is given below:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package arm-none-eabi-gcc
E: Unable to locate package arm-none-eabi-binutils
E: Unable to locate package arm-none-eabi-newlib
I found the solution based on the discussion available at https://unix.stackexchange.com/questions/377345/installing-arm-none-eabi-gcc and the documentation available on https://mynewt.apache.org/latest/get_started/native_install/cross_tools.html#installing-the-arm-cross-toolchain.
The name and structure of the software changed over time. The arm-none-eabi-gcc is gcc-arm-none-eabi now, and so on.
$ sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
$ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install gcc-arm-none-eabi
$ sudo apt-get install gdb-arm-none-eabi
And finally, to verify the downloads, you can run the following commands:
arm-none-eabi-gcc --version
arm-none-eabi-g++ --version
arm-none-eabi-size --version
In /etc/apt/sources.list, make sure the lines with universe are uncommented.
Re-run apt update and (as long as you have a working internter connection) it should work.

Install Julia >v1.1.1 on Raspberry Pi Zero W

I'm trying to use the PortAudio package in Julia on a Raspberry Pi Zero W running Raspberry Pi OS like so:
using Pkg
Pkg.add("PortAudio")
This fails with the error:
ERROR: Unsatisfiable requirements detected for package PortAudio [80ea8bcb]:
PortAudio [80ea8bcb] log:
├─possible versions are: 1.1.1-1.1.2 or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions 1.1.1-1.1.2
└─restricted by julia compatibility requirements to versions: uninstalled — no versions left
The version of Julia in apt is v1.0.3, which explains the above error. So I'm trying to install the latest version of Julia. The pre-compiled binaries won't run (Illegal instruction error) so I'm trying to compile it following the instructions from here:
sudo apt-get -y update
sudo apt-get install build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config libopenblas-dev git ccache
I then added this to /etc/dphys-swapfile
CONF_SWAPSIZE=8192
CONF_MAXSWAP=8192
Then
git clone https://github.com/JuliaLang/julia.git
cd julia
git checkout v1.6.2
make
This fails with this error:
Illegal instruction
make[1]: *** [Makefile:222: julia_flisp.boot] Error 132
make: *** [Makefile:43: julia_flisp.boot.inc.phony] Error 2
I think the issue here is that you need to tell it which ARM CPU the Pi uses, so following these instructions and this thread I added this to Make.user:
JULIA_CPU_TARGET=arm1176jzf-s
USE_BINARYBUILDER=0
But I get the same error, albeit with a suggestion to try make -C deps clean-openblas and rebuild with make OPENBLAS_USE_THREAD=0 or make OPENBLAS_TARGET_ARCH=NEHALEM. Neither fixes the problem. Also tried this python script (error downloading julia-1.6-latest ) and these instructions to install via docker (standard_init_linux.go:228: exec user process caused: exec format error) but could not get either to work.
I've tried absolutely everything I can find online. Someone please help! How do I install a recent version (>v1.1.1) of Julia on a Pi Zero?
I did it! Code quoted from this website:
yourmainPC $ ssh pi#raspberrypi.local # Assume You are going to login to your Pi via SSH
pi#raspberrypi $ curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh
pi#raspberrypi $ sudo gpasswd -a $USER docker # if you like to skip `sudo`
pi#raspberrypi $ exit
yourmainPC $ ssh pi#raspberrypi.local # login again
pi#raspberrypi $ JL_VERSION=v1.5.1
pi#raspberrypi $ IMAGE_NAME=terasakisatoshi/jlcross:rpizero-${JL_VERSION}
pi#raspberrypi $ CONTAINER_NAME=jltmp_${JL_VERSION}
pi#raspberrypi $ docker run --name ${CONTAINER_NAME} $IMAGE_NAME /bin/bash
pi#raspberrypi $ docker cp ${CONTAINER_NAME}:/home/pi/julia-${JL_VERSION} .
pi#raspberrypi $ docker rm ${CONTAINER_NAME}
pi#raspberrypi $ ls
julia-v1.5.1 # <---- this is it
pi#raspberrypi $ cd julia-v1.5.1/bin
pi#raspberrypi $ ./julia # tada!!!

How can I fix a "Segmentation fault" error running "dotnet" command on RasPi?

I am trying to install the ".NET Core 3.0" runtime on my old Raspberry Pi B+ first gen but I am not able to get it run because of a Segmentation fault running the dotnet command.
First of all I am using the arm32 version of the binaries, running all commands on a screen session (should not give problems at all), running Raspbian buster lite OS, and using the RasPi as a micro-server for lite-load dev purposes. That's to give some context.
I tried different approaches:
First
Downloaded the bins and installed them manually this way
sudo apt-get install curl libunwind8 gettext apt-transport-https
wget https://dotnetcli.blob.core.windows.net/dotnet/Runtime/release/3.0/dotnet-runtime-latest-linux-arm.tar.gz
sudo mkdir /usr/share/dotnet && sudo tar zxf dotnet.tar.gz -C /usr/share/dotnet
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
and I recived the error for the first time.
Second
Suspecting of a my installation fault i went online and found of a possible missing lib issue related to the error, so I went with this another thing I found, which is an installation script directly from Microsoft for the ".NET Core" family, straight after removing the "old" binaries (sudo rm -r /usr/share/dotnet) with the following steps
wget https://dot.net/v1/dotnet-install.sh
sudo ./dotnet-install.sh --channel Current --architecture arm --runtime dotnet --install-dir /usr/share/dotnet
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
with no visible results.
Third
Thinking about libs I went online for a second time and I tried to figure out the list of needed dependencies to manually install them and the only resource I found is this dedicated page on Microsoft's own website lacking of the arm32 dependencies list, so I went for the Ubuntu ones with this line
sudo apt install liblttng-ust0 libcurl3 libcurl4 libssl1.0.0 libkrb5-3 zlib1g libicu52 libicu55 libicu57 libicu60 libunwind8 libuuid1
but I only got a few installed because of various errors such as "no candidates", "outdated package", "already at newest version", and things like that; same with single installs.
After two days of retrying and doing fresh installs of Raspbian (yes, I also tried that a couple of times) I decided to try the "2.1 LTS" version but I got the exact same result with each of the 3 steps described for the 3.0 version.
As I could expect, I got the same overall result and that's very frustrating.
At this point I also looked for compatibility issues but I could not find something useful.
SO there is the question:
Is there any noticeable compatibility issue, a maybe too old piece of hardware? Can I work around that? And generally, does someone have kinda hint/suggestion/solution for my problem?
.Net Core does not support armv6 cpu, you can install .net core on Pi 2,3,4, but not on Pi.

Installing/Linking libwebsockets library in AWS Linux for mosquitto MQTT

Following the AWS Guide: https://aws.amazon.com/blogs/iot/how-to-bridge-mosquitto-mqtt-broker-to-aws-iot/ and I got to the step that has me install mosquitto.
//Update the list of repositories with one containing Mosquitto
sudo wget http://download.opensuse.org/repositories/home:/oojah:/mqtt/CentOS_CentOS-7/home:oojah:mqtt.repo -O /etc/yum.repos.d/mqtt.repo
//Install Mosquitto broker and Mosquitto command line tools
sudo yum install mosquitto mosquitto-clients
However, the guide is so outdated that it does not mention anything about the missing libwebsockets library. I've spent roughly 4-5 hours on searching for an answer on how to manually install/link/setup the library but I have not been able to make anything work.
(1) Tried this
git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=/usr/bin/gcc
make
sudo make install
But yea that didn't work because CMAKE throws all kinds of errors like
CMake Error at /usr/share/cmake/Modules/CMakeDetermineSystem.cmake:99 (message): Could not find toolchain file: /tmp/mytoolchainfile
Call Stack (most recent call first):
CMakeLists.txt:131 (project)
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Could not find cmake module file: /tmp/libwebsockets/build/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake
-- Configuring incomplete, errors occurred!
So I tried to set the CMAKE_C_COMPILER path to /usr/bin/gcc, which is where the compiler is installed and that didn't do anything either. In all honesty, I'm not super familiar with Linux, I'm just trying to make do the best I can. I could really use some guidance on how best to get library installed and linked into Linux. I do believe AWS runs a red-hat version of linux.
Thanks for your time!
I had this working using aws linux 2
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -P /tmp
sudo yum install -y /tmp/epel-release-latest-7.noarch.rpm
sudo yum install libwebsockets
sudo yum install mosquitto mosquitto-clients

error in Install previous versions of R on ubuntu

I have R 3.4.1.1 on my computer (Linux).
I want to install R version 2.14.1 since the package Rmosek does not work in newer version.
I have downloaded the R-2.14.2.tar.gz from Cran.
My problem is that I do not understand the INSTALL instructions,
It says to unpack the R sources and go to the top directory and issue the following commands:
./configure
make
I wrote the following in a terminal:
tar -zxvf R-2.14.2.tar.gz
cd Downloads
cd R-2.14.2
./configure
It is run but finally gives the error:
configure: error: --with-x=yes (default) and X11 headers/libs are not available
make
and it gives the error:
make: *** No targets specified and no makefile found. Stop.
The file explains that If my make is not called `make', set the environment variable MAKE to
its name, and use that name throughout these instructions. I really do not know how I should do it since I am new in Linux.
Is there any other instruction with more explanation? I would be very thankful in advance for your help or guidances.
Regards,
Shima.
This is answered in detail in the R installation and administration guide,
http://cran.r-project.org/doc/manuals/R-admin.html#Essential-programs-and-libraries
Unless you do not want to view graphs on-screen (or use a Mac) you
need ‘X11’ installed, including its headers and client libraries. For
recent Fedora distributions it means (at least) RPMs ‘libX11’,
‘libX11-devel’, ‘libXt’ and ‘libXt-devel’. On Debian we recommend the
meta-package ‘xorg-dev’. If you really do not want these you will need
to explicitly configure R without X11, using --with-x=no.
More specifically, for Ubuntu, this means:
sudo apt-get install xorg-dev
and then proceed with compiling and installing R.
If you have to compile R in your system and install you should have libx11-dev package installed in Ubunut.Can you check whether this package is installed or not.
Otherwise you can configure the source with this option as a work around solution only in the case if you are not going to use any GUI functionality in R.
./configure --with-x=no
You need to install these libraries:
sudo apt-get install -y libx11-dev \
xorg-dev \
libcurl4-openssl-dev
Then run:
./configure
make
And then it should work.
Good luck!

Resources