PackageCompiler errors on compile_incremental second run

I use Fezzik.jl (nice API for PackageCompiler). It allows to compile all statements used in REPL, that allows simple snooping, and tries to solve “time to first anything” problem. But I faced issue that it can’t run it on same sysimage second time, it is inconvenient because one can’t compile more statements into existing sysimage. Perhaps it is PackageCompiler compile_incremental problem.
Also rised issue here https://github.com/TsurHerman/Fezzik/issues/3

Two MWEs:

import AbstractPlotting, Makie; const ap = AbstractPlotting; ap.__init__(); s = ap.lines(rand(10))
Fezzik.brute_build_julia()
import Blink; w = Blink.Window();
Fezzik.brute_build_julia()
  1. No matters which of them I run first (first compile is successful), next compile fails.
  2. If I run each on fresh sysimage (after Fezzik.revert() ) - both are working.
  3. If I run both, then compile, it is also is working:
import AbstractPlotting, Makie; const ap = AbstractPlotting; ap.__init__(); s = ap.lines(rand(10))
import Blink; w = Blink.Window();
Fezzik.brute_build_julia()

So probably it is PackageCompiler compile_incremental problem?

If I compile Blink after AbstractPlotting and Makie, error is trowed:

julia> import Blink; w = Blink.Window();

julia> Fezzik.brute_build_julia()
[ Info: generating precompile
[Mux] already loaded
[WebSockets] already loaded
[Mustache] already loaded
[Lazy] already loaded
[MacroTools] already loaded
[REPL] already loaded
[Sockets] already loaded
[Blink] already loaded
[Base] already loaded
[Distributed] already loaded
[HTTP] already loaded
[JSON] already loaded
[WebIO] already loaded
[Base64] already loaded
[AbstractPlotting] already loaded
[JSExpr] already loaded
failed_packages = Symbol[]
[ Info: used 225 precompile statements
out_file = "/home/kest/.julia/packages/Fezzik/qjuGL/precomp.jl"



 Compiling...
[Mux] already loaded
[WebSockets] already loaded
[Mustache] already loaded
[Lazy] already loaded
[MacroTools] already loaded
[REPL] already loaded
[Sockets] already loaded
[Blink] already loaded
[Base] already loaded
[Distributed] already loaded
[HTTP] already loaded
[JSON] already loaded
[WebIO] already loaded
[Base64] already loaded
[AbstractPlotting] already loaded
[JSExpr] already loaded

signal (11): Segmentation fault
in expression starting at no file:0
jl_compile_linfo at /buildworker/worker/package_linux64/build/src/codegen.cpp:1176
emit_invoke at /buildworker/worker/package_linux64/build/src/codegen.cpp:3145
emit_expr at /buildworker/worker/package_linux64/build/src/codegen.cpp:3948
emit_ssaval_assign at /buildworker/worker/package_linux64/build/src/codegen.cpp:3662
emit_function at /buildworker/worker/package_linux64/build/src/codegen.cpp:3854
jl_compile_linfo at /buildworker/worker/package_linux64/build/src/codegen.cpp:1144
emit_invoke at /buildworker/worker/package_linux64/build/src/codegen.cpp:3145
emit_expr at /buildworker/worker/package_linux64/build/src/codegen.cpp:3948
emit_ssaval_assign at /buildworker/worker/package_linux64/build/src/codegen.cpp:3662
emit_function at /buildworker/worker/package_linux64/build/src/codegen.cpp:3854
jl_compile_linfo at /buildworker/worker/package_linux64/build/src/codegen.cpp:1144
jl_compile_hint at /buildworker/worker/package_linux64/build/src/gf.c:1949
jl_compile_specializations at /buildworker/worker/package_linux64/build/src/precompile.c:378 [inlined]
jl_precompile at /buildworker/worker/package_linux64/build/src/precompile.c:387 [inlined]
jl_write_compiler_output at /buildworker/worker/package_linux64/build/src/precompile.c:34
jl_atexit_hook at /buildworker/worker/package_linux64/build/src/init.c:222
main at /buildworker/worker/package_linux64/build/ui/repl.c:218
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
_start at /home/kest/Downloads/julia-1.1.1/bin/julia (unknown line)
Allocations: 29266051 (Pool: 29260059; Big: 5992); GC: 63
ERROR: failed process: Process(`/home/kest/Downloads/julia-1.1.1/bin/julia --optimize=3 --output-o=/home/kest/.julia/packages/PackageCompiler/CJQcs/sysimg/sys.a -g1 --track-allocation=none --startup-file=no --code-coverage=none --history-file=yes --inline=yes --math-mode=ieee --handle-signals=yes --warn-overwrite=no --compile=yes --depwarn=yes --cpu-target=native --track-allocation=none --sysimage-native-code=yes --sysimage=/home/kest/Downloads/julia-1.1.1/lib/julia/sys.so -g1 --compiled-modules=yes --optimize=2 /home/kest/.julia/packages/PackageCompiler/CJQcs/sysimg/run_julia_code.jl`, ProcessSignaled(11)) [0]
Stacktrace:
 [1] error(::String, ::Base.Process, ::String, ::Int64, ::String) at ./error.jl:42
 [2] pipeline_error at ./process.jl:785 [inlined]
 [3] #run#515(::Bool, ::Function, ::Cmd) at ./process.jl:726
 [4] run at ./process.jl:724 [inlined]
 [5] #run_julia#1 at /home/kest/.julia/packages/PackageCompiler/CJQcs/src/compiler_flags.jl:225 [inlined]
 [6] #run_julia at ./none:0 [inlined]
 [7] #compile_incremental#62(::Bool, ::Bool, ::Bool, ::Nothing, ::Function, ::Nothing, ::String) at /home/kest/.julia/packages/PackageCompiler/CJQcs/src/incremental.jl:137
 [8] #compile_incremental at ./none:0 [inlined]
 [9] #brute_build_julia#5(::Bool, ::Function) at /home/kest/.julia/packages/Fezzik/qjuGL/src/bootstrap.jl:184
 [10] brute_build_julia() at /home/kest/.julia/packages/Fezzik/qjuGL/src/bootstrap.jl:78
 [11] top-level scope at none:0

julia> 

How that could be explained?

1 Like