Skip to content

(Julia 1.12) UndefVarError: eval not defined in Main.anonymous when using custom_sysimage.jl Example per Sysimage Docs #1064

@patrickm663

Description

@patrickm663

Hi

I am hitting an error on Julia 1.12 with eval when attempting to use the custom_sysimage.jl example per https://julialang.github.io/PackageCompiler.jl/dev/devdocs/sysimages_part_1.html.

This previously worked on 1.11.7.

See below:

Base.init_depot_path()
Base.init_load_path()

using CSV

@eval Module() begin
    for (pkgid, mod) in Base.loaded_modules
        if !(pkgid.name in ("Main", "Core", "Base"))
            eval(@__MODULE__, :(const $(Symbol(mod)) = $mod))
        end
    end
    for statement in readlines("csv_precompile.jl")
        try
            Base.include_string(@__MODULE__, statement)
        catch
            # See julia issue #28808
            @info "failed to compile statement: $statement"
        end
    end
end # module

empty!(LOAD_PATH)
empty!(DEPOT_PATH)

Error:

303.1 ERROR: LoadError: UndefVarError: `eval` not defined in `Main.anonymous`
306.0 Suggestion: check for spelling errors or missing imports.
306.2 Stacktrace:
306.2  [1] top-level scope
306.2    @ /app/custom_sysimage.jl:9
306.2  [2] eval(m::Module, e::Any)
306.3    @ Core ./boot.jl:489
306.3  [3] top-level scope
306.3    @ /app/custom_sysimage.jl:6

Thanks for your assistance!

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