Skip to content

Instantly share code, notes, and snippets.

@terasakisatoshi
Last active December 7, 2021 07:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terasakisatoshi/3f8a55391b1fc22a5db4a43da8d92c98 to your computer and use it in GitHub Desktop.
Save terasakisatoshi/3f8a55391b1fc22a5db4a43da8d92c98 to your computer and use it in GitHub Desktop.
Build Julia for RaspberryPi Zero
apt-get update
apt-get install build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config git
apt install libopenblas-base libopenblas-dev
apt install libatlas3-base libatlas-base-dev
apt install liblapack-dev
apt install libmpfr-dev libgmp3-dev
apt install libgfortran3
git clone --depth=1 -b v1.1.0 https://github.com/JuliaLang/julia.git julia
cp Make.user julia
cd julia && make OPENBLAS_USE_THREAD=0 -j 40
sudo rm -rf julia
sudo docker run --rm -it -v $PWD:/home/pi/work -w /home/pi/work balenalib/raspberry-pi:stretch bash build.sh
JULIA_CPU_TARGET=arm1176jzf-s
prefix=/home/pi/work/julia-1.1.0
override USE_SYSTEM_BLAS=1
override USE_SYSTEM_LAPACK=1
override USE_SYSTEM_LIBM=1
override USE_SYSTEM_GMP=1
override USE_SYSTEM_MPFR=1
@terasakisatoshi
Copy link
Author

terasakisatoshi commented Apr 19, 2019

Usage

build Julia from source

  • install docker and docker-machine

  • pull base image of PiZero series

$ docker pull balenalib/raspberry-pi:stretch
  • just do it:
$ ls
build.sh doit.sh Make.user
$ bash doit.sh

It will generate julia-1.1.0 that contains Julia binary or runtime as same as you can get from https://julialang.org/downloads/

install julia on your RaspberryPi

copy julia-1.1.0 into your RaspberryPi e.g. using scp

# your main machine other than RaspberryPi
scp -r julia-1.1.0 pi@raspberrypi.local/home/pi

On your RaspberryPi, Install packages as same as that written in build.sh

$ sudo su (or you can type sudo apt install ....)
# apt-get update
# apt-get install build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config git 

# apt install libopenblas-base libopenblas-dev
# apt install libatlas3-base libatlas-base-dev
# apt install liblapack-dev
# apt install libmpfr-dev libgmp3-dev
# apt install libgfortran3

Finally, add Julia's path at .bashrc. That's all.

Reference

Binary

here is my google drive link that provides julia (v1.1.0) binary (NOT OFFICIAL) for Raspberry Pi series.

@terasakisatoshi
Copy link
Author

License

This instruction how to build julia is licensed under the terms of MIT License.

@terasakisatoshi
Copy link
Author

terasakisatoshi commented May 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment