-
-
Save terasakisatoshi/8a95eb8b676a29ad3f5fe4a717ff3254 to your computer and use it in GitHub Desktop.
#! /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 .. |
Hi Terasakisatoshi ,
Don't want to be a pain - but you seem to be very well placed to sort this out for me ( and for everybody who follows me ). I'm a big fan of JuliaLang and I would love to get it working on my Raspberry Pi. At the weekend some new SD Cards arrived in the post - so I rebuilt my Raspbian - and now typing "uname -a" returns "Linux raspberrypi 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux" ( which, as you can see was only released in February ).
I left my make.user file as it was :-
CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=0
prefix=/home/pi/julia-master-8987f7ac6d
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
and built the system - ( as the three lines in your previous comment were there ( although the prefix was different )) and two errors I got were :-
ln -sf /lib/arm-linux-gnueabihf/libmbedcrypto.so.3 /home/pi/build-julia-master-8987f7ac6d/usr/lib/julia/libmbedcrypto.so
ln -sf /lib/arm-linux-gnueabihf/libmbedx509.so.0 /home/pi/build-julia-master-8987f7ac6d/usr/lib/julia/libmbedx509.so
make[1]: *** [Makefile:207: /home/pi/build-julia-master-8987f7ac6d/usr/lib/julia/libnghttp2.so] Error 1
make: *** [Makefile:66: julia-base] Error 2
and tree :-
pi@raspberrypi:~/build-julia-master-8987f7ac6d $ tree -d -L 1
.
|-- base
|-- cli
|-- contrib
|-- deps
|-- doc
|-- etc
|-- src
|-- stdlib
|-- test
|-- usr
`-- usr-staging
11 directories
which has the \bin directory missing.
Doing the "make -j4" produces :-
pi@raspberrypi:~/build-julia-master-8987f7ac6d $ make -j4
rm: cannot remove './': Directory not empty
rm: cannot remove './bin/': Directory not empty
rm: cannot remove './bin/7z': Permission denied
/usr/bin/tar: ./bin/7z: Cannot open: File exists
/usr/bin/tar: Exiting with failure status due to previous errors
make[1]: *** [/home/pi/build-julia-master-8987f7ac6d/deps/p7zip.mk:41: /home/pi/build-julia-master-8987f7ac6d/usr/manifest/p7zip] Error 2
make: *** [Makefile:60: julia-deps] Error 2
As you can see I am out of my depth with understanding the errors - I am not even sure what it is trying to do at what stage.
Any help would be greatly appreciated - It is a shame that you can't get the JuliaBerry guys #simonbyrne and #avik ( both of which have their email addresses on their JuliaBerry website ) - to include your code into their JuliaBerry - and then things could be combined.
As many words as you can - please - because following the information above is difficult - especially when you don't really know what the code is trying to acheive at any given time.
Many thanks
Greg, Liverpool UK
Hi Greg, thank you for your feedback!
I'm a big fan of JuliaLang and I would love to get it working on my Raspberry Pi
Good to know!!! I hope you can make it.
Maybe our script build_locally.sh
is too old in 2021 😭 . BTW have you tried https://gist.github.com/terasakisatoshi/8a95eb8b676a29ad3f5fe4a717ff3254#gistcomment-3696889 ?
or build julia on current master ?
we do not have to set USE_BINARYBUILDER=0
, which makes rpi4 build julia from scratch including its dependencies.
Here is what I did note that lines including # are comment
# try it on your Raspberry Pi
$ git clone https://github.com/JuliaLang/julia.git
$ cd julia
$ git checkout d29126a43e
# `git rev-parse HEAD` should be
# d29126a43ee289fc5ab8fcb3dc0e03f514605950
# create `Make.user` as follows
MARCH=armv7-a
LDFLAGS=-latomic
# then, just do it
$ cat Make.user
MARCH=armv7-a
LDFLAGS=-latomic
$ julia -j4
$ ./julia # good luck.
@GregMc, how is it going ?
Hi Terasakisatoshi ,
You haven't heard from me - because I haven't managed to get a version of Julia later than 1.0.6 onto my RaspberryPi4. I have tried 'Make' and 'Build' and both get stuck at different stages. Basically I don't know enough about the process to make informed decisions. For example - Once a 'make' fails - do I need to delete the destination directory and re-run it with different settings - Or is there more screwed up elsewhere that once it has failed - only I new Raspbian Image will restore the situation. It is those sorts of questions that I am grabbling with at the moment.
Thanks for your help and interest.
cheers
Greg, Liverpool
Have you seen jlcross project ?
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
Good news. checkout sf/lbt_v303 branch JuliaLang/julia#40381
and prepare
Make.user
as follow:then just run
make -j4
.Edit note that
make install
fails