Skip to content

Instantly share code, notes, and snippets.

@terasakisatoshi
Created October 9, 2020 08:40
Show Gist options
  • Save terasakisatoshi/8a95eb8b676a29ad3f5fe4a717ff3254 to your computer and use it in GitHub Desktop.
Save terasakisatoshi/8a95eb8b676a29ad3f5fe4a717ff3254 to your computer and use it in GitHub Desktop.
Script to Build Julia locally for RaspberryPi4
#! /bin/bash
# Usage:
# 1. Copy this file to your raspberry pi e.g. /home/pi
# 2. Run this file `bash build_locally.sh`
# 3. Tested on Raspberry Pi4 with 4 or 8 GB
sudo apt-get update && sudo apt-get install -y \
build-essential libatomic1 python gfortran perl wget m4 cmake pkg-config \
nghttp2 libmbedtls-dev \
git
JL_VERSION=master
JL_BUILD_DIR=build-julia-${JL_VERSION}
# get JL_COMMIT_HASH via `git rev-parse --short HEAD`
JL_COMMIT_HASH=8987f7ac6d
JL_BUILD_DIR=build-julia-${JL_VERSION}-${JL_COMMIT_HASH}
git clone https://github.com/JuliaLang/julia.git $JL_BUILD_DIR && \
cd ${JL_BUILD_DIR} && git checkout ${JL_COMMIT_HASH} && cd ..
cat > ${JL_BUILD_DIR}/Make.user << EOF
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
prefix=/home/pi/julia-${JL_VERSION}-${JL_COMMIT_HASH}
USE_BINARYBUILDER=0
LDFLAGS=-latomic
CFLAGS += "-mfpu=neon-vfpv4"
CXXFLAGS += "-mfpu=neon-vfpv4"
MARCH="armv7-a"
JULIA_CPU_TARGET="armv7-a\;armv7-a,neon\;armv7-a,neon,vfp4"
USE_SYSTEM_NGHTTP2=1
USE_SYSTEM_MBEDTLS=1
EOF
cd ${JL_BUILD_DIR} && make -j `nproc` && sudo make install && cd ..
@terasakisatoshi
Copy link
Author

Have you seen jlcross project ?

https://github.com/Julia-Embedded/jlcross

@GregMc
Copy link

GregMc commented Apr 22, 2021

Thanks Terasakisatoshi , I've had a look and it looks very interesting - I haven't yet had a chance to try any of the stuff.

Once a 'make' or a 'build' fails - where can I restart the process from - Am I having to reflash a SD Card every time, OR can I just delete the directories I can see - and try again. I think that's my biggest problem.

Cheers for your help

Greg, Liverpool

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