Skip to content

Instantly share code, notes, and snippets.

@JaredCrean2
Created February 16, 2017 01:20
Show Gist options
  • Save JaredCrean2/3758c598f7cf66a5acbdd4e4176cf83c to your computer and use it in GitHub Desktop.
Save JaredCrean2/3758c598f7cf66a5acbdd4e4176cf83c to your computer and use it in GitHub Desktop.
#!/bin/bash
# get julia
git clone https://github.com/JuliaLang/julia.git
cd ./julia
git pull
#git checkout jn/release-0.5-fix-compile-all
# the branch doesn't exist anymore, so use the commit
git checkout 30583268f4ec716c824f9c906f03a75f73e255f8
cd ..
# two version, with and without codegen
cp -r ./julia ./julia_nocodegen
mv -v ./julia ./julia_codegen
# build them
echo "building julia with code generation"
cd ./julia_codegen
make -j 4 >fout 2>errout
cd ..
echo "building julia without code generation"
cd ./julia_nocodegen
make JULIACODEGEN=none -j 4 >fout 2>errout # this will exit with non-zero status
cd ..
# executables
julia_codegen=`pwd`"/julia_codegen/usr/bin/julia"
julia_nocodegen=`pwd`"/julia_nocodegen/usr/bin/julia"
# build system image using the codegen version
echo "building system image"
$julia_codegen --output-o sys-all.o --sysimage `pwd`/julia_codegen/usr/lib/julia/sys.so --startup-file=no --compile=all --eval nothing
gcc --share -o sys-all.so sys-all.o
# run hello world with both versions
# this appears to work, but running the command in the repl does not
echo "using julia_codegen to run hello world with compiler disabled"
$julia_codegen --compile=no --sysimage sys-all.so -e 'println("hello world")'
echo "using julia_nocodegen to run hello world with compiler disabled"
$julia_nocodegen --compile=no --sysimage sys-all.so -e 'println("hello world")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment