Skip to content

World age increment not at top level precompilation error with Julia 1.12+ #1218

Closed
@mortenpi

Description

@mortenpi

Opening this mostly for visibility -- I think this is a PrecompileTools regression (JuliaLang/PrecompileTools.jl#58), but the syntax that causes it is a bit weird.

But HTTP fails to precompile on 1.12+ when using PrecompileTools 1.3.1 with:

Failed to precompile HTTP [cd3eb016-35fb-5094-929b-558a96fad6f3] to "/home/mortenpi/.julia/compiled/v1.12/HTTP/jl_evsPzI".
ERROR: LoadError: syntax: World age increment not at top level
Stacktrace:
  [1] top-level scope
    @ ~/oss/HTTP.jl/src/precompile.jl:3
  [2] include(mapexpr::Function, mod::Module, _path::String)
    @ Base ./Base.jl:304
  [3] top-level scope
    @ ~/oss/HTTP.jl/src/HTTP.jl:643
  [4] include(mod::Module, _path::String)
    @ Base ./Base.jl:303
  [5] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:3015
  [6] top-level scope
    @ stdin:5
  [7] eval(m::Module, e::Any)
    @ Core ./boot.jl:489
  [8] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:2861
  [9] include_string
    @ ./loading.jl:2871 [inlined]
 [10] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:326
 [11] _start()
    @ Base ./client.jl:560
in expression starting at /home/mortenpi/oss/HTTP.jl/src/precompile.jl:3
in expression starting at /home/mortenpi/oss/HTTP.jl/src/HTTP.jl:1
in expression starting at stdin:

It seems to be due to the withenv around @compile_workload (see the MWE in the linked issue):

withenv(env...) do
@compile_workload begin
HTTP.get(url);
end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions