Issue
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?
Solution
I did it! Code quoted from this website:
yourmainPC $ ssh [email protected] # 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 [email protected] # 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!!!
Answered By - Thomas