Cross-compile FSWEBCAM for Raspberry Pi 2 (YOCTO) - graphics

I'm using Yocto as OS for my Raspberry Pi.
I want to crosscompile fswebcam but is showing and error.
cd ~
git clone https://github.com/fsphil/fswebcam.git
cd fswebcam
. /opt/poky/2.3/environment-setup-cortexa7hf-neon-vfpv4-poky-linux-gnueabi
mkdir -R build/usr
cd build
../configure --prefix=/home/pablo/test_toolchain/fswebcam/build/usr --host=arm-poky-linux-gnueabi-gcc
Error-> configure: error: GD graphics library not found
Note: I cannot install apt or any package manager, it must be crosscompiled

Yocto is not an OS... but if you use Yocto as a build system and write an actual recipe for fswebcam this shouldn't be too difficult: According to layers.openembedded.org libgd (the dependency you need) is in meta-oe: https://layers.openembedded.org/layerindex/recipe/1037/.
There is a fswebcam recipe in meta-atmel already, it might work as is or at least work as a starting point: https://github.com/linux4sam/meta-atmel/blob/master/recipes-multimedia/fswebcam/fswebcam_git.bb

Related

Error in building libcamera library on Raspberry Pi Bullseye

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

LFS CoreUtils-8.30 fails with aclocal-1.15 missing

I have a standard core i5 laptop and I'm trying to make LFS (Linux From Scratch) it has all worked fine (after a couple of retries) until I try and make Coreutils-8.30 when I do the Make I get:
lfs#robert-HP-EliteBook-8760w:/mnt/lfs/sources/coreutils-8.30$ make
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh /mnt/lfs/sources/coreutils-8.30/build-aux/missing aclocal-1.15 -I m4
/mnt/lfs/sources/coreutils-8.30/build-aux/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>
Makefile:6034: recipe for target 'aclocal.m4' failed
make: *** [aclocal.m4] Error 127
I've gone around and around on this and I'm not getting anywhere. I've found a couple of references to gettext but that hasn't helped.
Thanks for any guidance.
Just got through the same issue. You need to install libtool-bin, automake and makeinfo
sudo apt-get install libtool-bin automake makeinfo
Then run autoreconf -f -i in the mpfr directory. After that you can run ./configure etc.
I ran into this issue when I applied the patch for coreutils that was provided in the downloads. I noticed the instructions did not tell me to apply this patch at this step so I tried to build again without the patch applied and it worked.
I just met and solved this problem,My solution is not necessarily the best。
This questions because you don't have "aclocal" tools with version 1.15,
This tools provided by automake-1.15, which depended by autoconf-2.69 or later.
So My solution is installing autoconf-2.69 and automake-1.15:
1. installing autoconf-2.69
tar -xvf autoconf-2.69.tar.xz
./configure --prefix=/tools
make && make install
2. installing automake-1.15
tar -xvf automake-1.15.tar.xz
./configure --prefix=/tools
make && make install
then you can compile your coreutils-8.30
Check if autoinfo from gettext is installed OK.
This error when building coreutils is caused by absence of autopoint.

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 when connecting Azure IoT Suite with Raspberry Pi

I am attempting to link my Raspberry Pi to my Azure IoT suite using this tutorial.
I get these errors when entering the following code into my terminal:
cd ~/azure-iot-sdks/
sudo ~/azure-iot-sdks/c/build_all/linux/setup.sh
chmod +x ~/azure-iot-sdks/c/build_all/linux/build.sh
~/azure-iot-sdks/c/build_all/linux/build.sh
Any help is appreciated, as I cannot wait to connect my Pi to Azure!
I've verified the tutorial works on various environments,
Host: Ubuntu 14.04, gcc version 4.8.4, cmake version 2.8.12.2, build succesfully.
Host: Ubuntu 14.04, gcc version 4.9.3, cmake version 2.8.12.2, build succesfully.
Host: Ubuntu 14.04, gcc version 4.9.3, cmake version 3.3.2, build succesfully.
Host: Bash On Ubuntu On Windows, gcc version 4.8.4, cmake version 2.8.12.2, build succesfully.
Interesting thing is although gcc(>=4.9) and cmake(>=3.0) is recommended per this page, I found gcc 4.8 and cmake 2.8 also works find with this tutorial.
Anyway, you need to make sure you follow the steps thoroughly,
Clone iot-hub-c-raspberrypi-getstartedkit and WiringPi repositories, with the --recursive parameter.
Go to WiringPi and do ./build. This step is not mentioned in the tutorial but I found it necessary.
Make sure you have all the tools installed,
sudo apt-get install curl libcurl4-openssl-dev uuid-dev uuid g++ make cmake git unzip openjdk-7-jre libssl-dev libncurses-dev subversion gawk
Build the source code,
cd ~/iot-hub-c-raspberrypi-getstartedkit/
sudo ~/iot-hub-c-raspberrypi-getstartedkit/azure-iot- sdks/c/build_all/linux/setup.sh
chmod +x ~/iot-hub-c-raspberrypi-getstartedkit/sample/build.sh
~/iot-hub-c-raspberrypi-getstartedkit/sample/build.sh
I've verified following the steps above, it builds successfully on various environments.

libmnl Issue while installing libnetfilter queue in linux

I am trying to install libnetfilter_queue on Suse Linux. But after the
./configure step it shows
error: Package requirements (libmnl >= 1.0.3) were not met
No package 'libmnl' found
I am new to Linux and all the solutions which are available on the web, I don't know how to use them.
How can I fix this problem?
It is a common problem to the people working in computer networking in linux environments.
Go to the below link and download the latest libmnl file.
http://www.netfilter.org/projects/libmnl/downloads.html#libmnl-1.0.3
Unzip it using the below command
tar -xvf libmnl-1.0.3.tar.bz2
cd to the extracted folder
cd libmnl-1.0.3/
Install libmnl
./configure
make
sudo make install
Then you can install the libnetfilter_queue library.

Resources