Skip to content

Instantly share code, notes, and snippets.

@terasakisatoshi
Last active May 2, 2019 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save terasakisatoshi/00fa7d7b81b7c6748f2298f6ff65bf6e to your computer and use it in GitHub Desktop.
Save terasakisatoshi/00fa7d7b81b7c6748f2298f6ff65bf6e to your computer and use it in GitHub Desktop.
Cross Compile Julia For RaspberryPi3 using Docker
JULIA_CPU_TARGET=cortex-a7
MARCH=armv7-a
prefix=/home/pi/work/julia-1.1.0
apt-get update
apt-get install build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config git
git clone --depth=1 -b v1.1.0 https://github.com/JuliaLang/julia.git
cp Make.user julia/Make.user
@terasakisatoshi
Copy link
Author

terasakisatoshi commented Apr 13, 2019

  1. Choose base image from https://www.balena.io/docs/reference/base-images/base-images-ref/ or https://hub.docker.com/r/balenalib/armv7hf-debian. I tested the latter case.
  2. Make work space. for example replace /path/to/work with ~/work
# on your build machine
$ mkdir -p /path/to/work
$ cd /path/to/work
  1. And then run container
# Download Make.user and prepare.sh so that result of cmd ls contains Make.user and prepare.sh
$ ls 
Make.user prepare.sh
$ sudo docker run --rm -it -v $PWD:/home/pi/work -w /home/pi/work balenalib/raspberrypi3:stretch bash
docker # bash prepare.sh
docker # cd julia
docker # make -j 8 && make install
exit

copy 'julia-1.1.0` on your raspberry pi 3

@terasakisatoshi
Copy link
Author

terasakisatoshi commented Apr 13, 2019

References

julia/README.arm.md

Balena base images

Which image should i use ?

Both
Dockerfile of base-images/balena-base-images/armv7hf/debian/stretch

and

Dockerfile of base-images/balena-base-images/device-base/raspberrypi3/debian/stretch

came from same base image of arm32v7/debian:stretch-slim . This means we can use both.

@terasakisatoshi
Copy link
Author

terasakisatoshi commented Apr 18, 2019

Appendix

For raspberrypi zero user

$ sudo docker run --rm -it -v $PWD:/home/pi/work -w /home/pi/work balenalib/raspberry-pi:stretch bash

Make.user

JULIA_CPU_TARGET=arm1176jzf-s
make OPENBLAS_USE_THREAD=0
prefix=/home/pi/work/julia-1.1.0

Binary

here is my google drive link that provides julia 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.

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