Install Julia >v1.1.1 on Raspberry Pi Zero W - audio

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!!!

Related

BitBake Build Fail (Error) using Yocto Hardknott 5.10.72-2.2.2 for imx8mp-lddr4-evk board

I am following a documentation for building yocto hardknott using NXP imx8m plus EVK board. But I encountered a build problem using Bitbake when I try to build "bitbake-image-full" using Ubuntu 18.04 LTS.
Build Configuration:
BB_VERSION = "1.50.0"
BUILD_SYS = "x86_64-linux"
NATIVELSBSTRING = "ubuntu-18.04"
TARGET_SYS = "aarch64-poky-linux"
MACHINE = "imx8mp-lpddr4-evk"
DISTRO = "fsl-imx-xwayland"
DISTRO_VERSION = "5.10-hardknott"
ERROR:
But that error wasn't consistent. After trying to rebuild, a different recipe error will appear. Anyone can help me identify what is going on within the build process?
Codes I run:
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build essential chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint3 xterm rsync curl zstd pzstd lz4c lz4 libssl-dev
$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH
$ mkdir ~/imx-yocto-bsp
$ cd ~/imx-yocto-bsp
$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-hardknott -m imx-5.10.72-2.2.2.xml
$ repo sync -j$(nproc)
$: MACHINE=imx8mp-lpddr4-evk DISTRO=fsl-imx-xwayland source ./imx-setup-release.sh -b build-xwayland
$: bitbake imx-image-full
I tried rebuilding the image from the start but same error happens. I wonder if it has something to do with the host machine.
Memory: 15.5 GiB
Procesor Intel Corę i7-8700 CPU # 3.20GHz x 12
Graphics Intel UHD Graphics 630
GNOME 3.28.2
OS type 64-bit
Disk 491.1 GB

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

how to install gcc-12 on ubuntu

$ sudo apt search gcc-12
Sorting... Done
Full Text Search... Done
$ uname -a
Linux Han 5.10.81.1-microsoft-standard-WSL2 #1 SMP Mon Nov 22 18:52:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I am using the default sources.list file, I want to install gcc-12 but I can't find it in the mirror source, what should I do!
gcc-12 is not available in ubuntu 20.04, so we need to compile it from source code, here are the steps which I borrowed from this video:
Step 1: clone gcc source code and checkout gcc-12 branch
$ git clone https://gcc.gnu.org/git/gcc.git gcc-source
$ cd gcc-source/
$ git branch -a
$ git checkout remotes/origin/releases/gcc-12
Step 2: make another build dir
Note this is important as running ./configure from within the source directory is not supported as documented here.
$ mkdir ../gcc-12-build
$ cd ../gcc-12-build/
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
Step 3: installing GCC prequisites and run configure again
The missing libraries will be shown in above ./confgiure output, search and install them one by one.
$ apt-cache search MPFR
$ sudo apt-get install libmpfrc++-dev
$ apt-cache search MPC | grep dev
$ sudo apt-get install libmpc-dev
$ apt-cache search GMP | grep dev
$ sudo apt-get install libgmp-dev
$ sudo apt-get install gcc-multilib
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
An alternartive is to run the download_prerequisites script.
$ cd ../
$ cd gcc-source/
$ ./contrib/download_prerequisites
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
Step 4: compile gcc-12
$ make -j16
Still flex is missing:
$ sudo apt-get install flex
$ ./../gcc-source/configure --prefix=$HOME/install/gcc-12 --enable-languages=c,c++
$ make -j16
$ make install
Another way is to use Ubuntu 22.04 where gcc-12 is available. In Ubuntu 22.04, gcc-12 can be installed with apt:
$ sudo apt install gcc-12
You can use Homebrew to install pre-built binaries.
Follow instructions to install Homebrew at https://brew.sh/, then
brew install gcc for default GCC (currently 11) or brew install gcc#12 for gcc-12.
Note that it may compile missing dependencies.
I would add if you are adding for 64 bit only, you'll want to add "--disable=multilib" to the end of your configure statement.

Updating a lightning node to latest version

I'm running a lightning node (a 2nd layer for bitcoin transactions) on a Raspberry Pi. I'm still learning about the technology and linux as well. But I'm not sure how to securely update my node to the new LND version 0.4.1 and I'd like some directions.
I already downloaded the new LND binaries and checked the keys.
$ wget https://github.com/lightningnetwork/lnd/releases/download/v0.4.1-beta/lnd-linux-arm-v0.4.1-beta.tar.gz
I used this to install the previous version (0.4-beta) from scratch:
$ tar -xzf lnd-linux-arm-v0.4-beta.tar.gz
$ ls -la
$ sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-arm-v0.4-beta/*
But how should I proceed if I just want to update, considering I'm not installing from scratch again? What commands should I use on linux?
LND official installation instructions are not very clear.
I found out how to do it.
Update a lightning node on a Raspberry Pi is actually very easy.
First, it's safe to stop your node:
$ sudo systemctl stop lnd
then download the new version (change version accordingly) from github:
$ cd /download
$ wget https://github.com/lightningnetwork/lnd/releases/download/v0.4.1-beta/lnd-linux-arm-v0.4.1-beta.tar.gz
and install as if you were installing for the first time:
$ tar -xzf lnd-linux-arm-v0.4.1-beta.tar.gz
$ ls -la
$ sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-arm-v0.4.1-beta/*
then restart the service:
sudo systemctl start lnd

Installing node.js on raspberry pi 2

I have installed Raspbian on my Raspberry Pi 2 and now I am trying to install node.js on it, however I am hitting an issue.
I followed the instructions and typed these commands into the terminal
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
sudo dpkg -i node_latest_armhf.deb
But when I check the version of node using
node -v
I get this error:
node: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by node)
node: /lib/arm-linus-gnueabihf/libc.so.6: version `GLIBC_2.16' not found (required by node)
I am quite new to using raspberry pi, so any help to fix this issue would be great!
Just putting the response from #Prashant Pathak above here:
Download latest nodejs build for Raspberry Pi:
wget https://nodejs.org/download/release/v0.10.0/node-v0.10.0-linux-arm-pi.tar.gz
Unpack files in local directory:
cd /usr/local
sudo tar xzvf ~/node-v0.10.0-linux-arm-pi.tar.gz --strip=1
That's it.
You can confirm it's there by checking the node version with:
node -v
and:
npm -v
The actual url to get the files for node will change as the version changes, you can always see the list of files available for download here:
http://nodejs.org/download/
All these instructions came from:
http://www.robert-drummond.com/2015/01/08/server-side-javascript-on-a-raspberry-pi-how-to-install-node-js-2/
Alternatively you can upgrade your GCC to V4.8 for this package to work!
Option 1 (the better option):
sudo apt-get update
sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
Options 2: Upgrade to Debian Jessie
Replace all instances of "wheezy" in /etc/apt/sources.list
sudo apt-get update
sudo apt-get dist-upgrade
After this you download the Node.js using command line as follows:
wget http://node-arm.herokuapp.com/node_latest_armhf.deb
Next step is to install the Node.js:
sudo dpkg -i node_latest_armhf.deb
Finally, you can verify the installation:
node -v
These instructions are mentioned on http://node-arm.herokuapp.com/
That runs for me:
http://blog.wia.io/installing-node-js-v4-0-0-on-a-raspberry-pi/
Raspberry Pi Model A, B, B+ and Compute Module
wget https://nodejs.org/dist/v4.0.0/node-v4.0.0-linux-armv6l.tar.gz
tar -xvf node-v4.0.0-linux-armv6l.tar.gz
cd node-v4.0.0-linux-armv6l
Raspberry Pi 2 Model B
wget https://nodejs.org/dist/v4.0.0/node-v4.0.0-linux-armv7l.tar.gz
tar -xvf node-v4.0.0-linux-armv7l.tar.gz
cd node-v4.0.0-linux-armv7l
sudo cp -R * /usr/local/
use nodejs instead of node
sudo apt-get update && sudo apt-get install nodejs
for npm
sudo apt-get install npm
The Latest Node is released for the below platforms, which helped for my old R-PI which is of model name : ARMv6-compatible processor rev 7 (v6l)
https://nodejs.org/download/release/v4.1.0/
node-v4.1.0-linux-arm64.tar.gz 17-Sep-2015 04:24 10886090
node-v4.1.0-linux-arm64.tar.xz 17-Sep-2015 04:24 7100824
node-v4.1.0-linux-armv6l.tar.gz 17-Sep-2015 17:37 10763504
node-v4.1.0-linux-armv6l.tar.xz 18-Sep-2015 00:15 7005048
node-v4.1.0-linux-armv7.tar.gz 17-Sep-2015 05:17 10773951
node-v4.1.0-linux-armv7.tar.xz 17-Sep-2015 05:18 7004760
node-v4.1.0-linux-armv7l.tar.gz 18-Sep-2015 12:58 10773951
You can try the following command:
wget node-arm.herokuapp.com/node_archive_armhf.deb
then
sudo dpkg -i node_archive_armhf.deb
node -v should work now!

Resources