See https://github.com/JuliaPy/PyCall.jl/tree/master/aot
I guess it would be something like
PYTHON=python2 aot/compile.jl --color=yes
cp aot/sys.so sys-python2.so # copy it to somewhere
julia -J sys-python2.so
You might also want to add
Base.eval(Base, quote
function package_slug(uuid::UUID, p::Int=5)
crc = _crc32c(uuid)
crc = _crc32c(unsafe_string(JLOptions().image_file), crc)
return slug(crc, p)
end
end)
in aot/precompile.jl
so that precompilation cache for sys-python2.so
is isolated from your normal precompilation cache. (I’ve been using this trick in jlm and PyJulia; ref ANN: a solution to the precompilation problem: JuliaManager.jl / jlm CLI, a system image manger for Julia)