Skip to content

Instantly share code, notes, and snippets.

@SimonDanisch
Created November 30, 2018 19:44
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 SimonDanisch/fdd091556035007415c6f3caee7001b5 to your computer and use it in GitHub Desktop.
Save SimonDanisch/fdd091556035007415c6f3caee7001b5 to your computer and use it in GitHub Desktop.
base = dirname(Base.find_source_file("sysimg.jl"))
file = "/home/sd/Desktop/precompile.jl" # snippet from slack
cd(homedir() * "/Desktop")
filebase = homedir() * "/Desktop/sysimg"
mkdir(filebase)
cd(base)
run(`julia1 --output-ji $filebase/corecompiler.ji --startup-file=no -g0 -O0 compiler/compiler.jl`)
run(`julia1 -g1 -O0 -C "native" --output-ji $filebase/sys.ji --startup-file=no --warn-overwrite=yes --sysimage $filebase/corecompiler.ji sysimg.jl`)
run(`julia1 -O3 -C "native" --output-o $filebase/sys.a --startup-file=no --warn-overwrite=yes --sysimage $filebase/sys.ji $file`)
run(`g++ -m64 -shared -fPIC -L/home/sd/juliastuff/julia/usr/lib/julia -L/home/sd/juliastuff/julia/usr/lib -L/home/sd/juliastuff/julia/usr/lib -o $filebase/sys.so -Wl,--whole-archive $filebase/sys.a -Wl,--no-whole-archive`)
@SimonDanisch
Copy link
Author

if !isdefined(Base, :uv_eventloop)
    Base.reinit_stdio()
end
Base.init_load_path()
Base.init_depot_path()
using Pkg
Pkg.activate("/home/sd/.julia/environments/v1.0/")
using CompileTest
precompile(Tuple{typeof(CompileTest.greet)})
empty!(LOAD_PATH)

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