Precompilation issue with any module that wraps Plots

Hi all,

I’m on Julia Version 0.7.0 (2018-08-08 06:46 UTC), with Plots v0.19.3 and GR v0.34.1, both of which installed and pre-compiled without a problem and can produce and save plots with plot and savefig without any issue.

I want to build a module of my own that uses Plots. At the moment it looks like this:

__precompile__()

"PlotsX <- My module for extending functionality to do with Plots"
module PlotsX

using Plots

end #module

Pretty simple module. However, whenever Julia tries to precompile it, I get the following (rather long) set of warnings:

julia> using PlotsX
[ Info: Recompiling stale cache file /home/colin/.julia/compiled/v0.7/PlotsX.ji for PlotsX [top-level]
WARNING: eval from module Plots to PlotsX:    
Expr(:call, Expr(:., :Sys, :(:islinux)))
  ** incremental compilation may be broken for this module **

WARNING: eval from module Plots to PlotsX:    
Expr(:function, Expr(:call, :_show, Expr(:::, :io, :IO), Expr(:::, Expr(:curly, :MIME, Expr(:call, :Symbol, "application/postscript"))), Expr(:::, :plt, Expr(:curly, :Plot, :GRBackend))), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1379 =#, Expr(:call, Expr(:., :GR, :(:emergencyclosegks))), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1380 =#, :filepath = Expr(:call, :*, Expr(:call, :tempname), ".", "ps"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1381 =#, :env = Expr(:call, :get, :ENV, "GKSwstype", "0"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1382 =#, Expr(:ref, :ENV, "GKSwstype") = "ps", #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1383 =#, Expr(:ref, :ENV, "GKS_FILEPATH") = :filepath, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1384 =#, Expr(:call, :gr_display, :plt, "ps"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1385 =#, Expr(:call, Expr(:., :GR, :(:emergencyclosegks))), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1386 =#, Expr(:call, :write, :io, Expr(:call, :read, :filepath, :String)), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1387 =#, Expr(:call, :rm, :filepath), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1388 =#, Expr(:if, Expr(:call, :!=, :env, "0"), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1389 =#, Expr(:ref, :ENV, "GKSwstype") = :env), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1391 =#, Expr(:call, :pop!, :ENV, "GKSwstype")))))
  ** incremental compilation may be broken for this module **

WARNING: eval from module Plots to PlotsX:    
Expr(:function, Expr(:call, :_show, Expr(:::, :io, :IO), Expr(:::, Expr(:curly, :MIME, Expr(:call, :Symbol, "application/pdf"))), Expr(:::, :plt, Expr(:curly, :Plot, :GRBackend))), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1379 =#, Expr(:call, Expr(:., :GR, :(:emergencyclosegks))), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1380 =#, :filepath = Expr(:call, :*, Expr(:call, :tempname), ".", "pdf"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1381 =#, :env = Expr(:call, :get, :ENV, "GKSwstype", "0"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1382 =#, Expr(:ref, :ENV, "GKSwstype") = "pdf", #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1383 =#, Expr(:ref, :ENV, "GKS_FILEPATH") = :filepath, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1384 =#, Expr(:call, :gr_display, :plt, "pdf"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1385 =#, Expr(:call, Expr(:., :GR, :(:emergencyclosegks))), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1386 =#, Expr(:call, :write, :io, Expr(:call, :read, :filepath, :String)), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1387 =#, Expr(:call, :rm, :filepath), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1388 =#, Expr(:if, Expr(:call, :!=, :env, "0"), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1389 =#, Expr(:ref, :ENV, "GKSwstype") = :env), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1391 =#, Expr(:call, :pop!, :ENV, "GKSwstype")))))
  ** incremental compilation may be broken for this module **

WARNING: eval from module Plots to PlotsX:    
Expr(:function, Expr(:call, :_show, Expr(:::, :io, :IO), Expr(:::, Expr(:curly, :MIME, Expr(:call, :Symbol, "image/png"))), Expr(:::, :plt, Expr(:curly, :Plot, :GRBackend))), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1379 =#, Expr(:call, Expr(:., :GR, :(:emergencyclosegks))), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1380 =#, :filepath = Expr(:call, :*, Expr(:call, :tempname), ".", "png"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1381 =#, :env = Expr(:call, :get, :ENV, "GKSwstype", "0"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1382 =#, Expr(:ref, :ENV, "GKSwstype") = "png", #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1383 =#, Expr(:ref, :ENV, "GKS_FILEPATH") = :filepath, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1384 =#, Expr(:call, :gr_display, :plt, "png"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1385 =#, Expr(:call, Expr(:., :GR, :(:emergencyclosegks))), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1386 =#, Expr(:call, :write, :io, Expr(:call, :read, :filepath, :String)), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1387 =#, Expr(:call, :rm, :filepath), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1388 =#, Expr(:if, Expr(:call, :!=, :env, "0"), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1389 =#, Expr(:ref, :ENV, "GKSwstype") = :env), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1391 =#, Expr(:call, :pop!, :ENV, "GKSwstype")))))
  ** incremental compilation may be broken for this module **

WARNING: eval from module Plots to PlotsX:    
Expr(:function, Expr(:call, :_show, Expr(:::, :io, :IO), Expr(:::, Expr(:curly, :MIME, Expr(:call, :Symbol, "image/svg+xml"))), Expr(:::, :plt, Expr(:curly, :Plot, :GRBackend))), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1379 =#, Expr(:call, Expr(:., :GR, :(:emergencyclosegks))), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1380 =#, :filepath = Expr(:call, :*, Expr(:call, :tempname), ".", "svg"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1381 =#, :env = Expr(:call, :get, :ENV, "GKSwstype", "0"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1382 =#, Expr(:ref, :ENV, "GKSwstype") = "svg", #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1383 =#, Expr(:ref, :ENV, "GKS_FILEPATH") = :filepath, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1384 =#, Expr(:call, :gr_display, :plt, "svg"), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1385 =#, Expr(:call, Expr(:., :GR, :(:emergencyclosegks))), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1386 =#, Expr(:call, :write, :io, Expr(:call, :read, :filepath, :String)), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1387 =#, Expr(:call, :rm, :filepath), #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1388 =#, Expr(:if, Expr(:call, :!=, :env, "0"), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1389 =#, Expr(:ref, :ENV, "GKSwstype") = :env), Expr(:block, #= Symbol("/home/colin/.julia/packages/Plots/ex9On/src/backends/gr.jl"):1391 =#, Expr(:call, :pop!, :ENV, "GKSwstype")))))
  ** incremental compilation may be broken for this module **

WARNING: eval from module Plots to PlotsX:    
Expr(:call, Expr(:., :Sys, :(:isapple)))
  ** incremental compilation may be broken for this module **

WARNING: eval from module Plots to PlotsX:    
Expr(:||, Expr(:call, Expr(:., :Sys, :(:islinux))), Expr(:call, Expr(:., :Sys, :(:isbsd))))
  ** incremental compilation may be broken for this module **

WARNING: eval from module Plots to PlotsX:    
Expr(:call, Expr(:., :Sys, :(:iswindows)))
  ** incremental compilation may be broken for this module **

I can just ignore the warnings and go on with my life, but I thought it might be worth asking here first in case someone can shed any light on what is going on here. Also, there are no warnings if I set __precompile__(false) at the top of the module…

Cheers,

Colin

Looks like https://github.com/JuliaLang/julia/issues/29059, fixed by https://github.com/JuliaLang/julia/pull/29483 so you can try with Julia master.

Checking out Plots master should also be enough (see https://github.com/JuliaPlots/Plots.jl/pull/1772).

Brilliant thanks. Apologies that my googling missed that.

And that’s even more specifically on point than Fredriks response. I must have been half asleep when originally googling this issue. Thanks so much for responding, I’ll switch plots to master.

Cheers,

Colin