Skip to content

ClimaOcean can't precompile with ClimaSeaIce v0.4.6 #128

@juliasloan25

Description

@juliasloan25

When I update ClimaCoupler to use ClimaSeaIce 0.4.6, I get the following error:

Failed to precompile ClimaOcean [0376089a-ecfe-4b0e-a64f-9c555d74d754] to "/Users/jsloan/.julia/compiled/v1.12/ClimaOcean/jl_jlrONG".
ERROR: LoadError: InitError: Evaluation into the closed module `ClimaSeaIceNCDatasetsExt` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `ClimaSeaIceNCDatasetsExt` with `eval` during precompilation - don't do this.

The @eval in ClimaSeaIceNCDatasetsExt defines a new method in OceananigansNCDatasetsExt at precompile time, which breaks incremental compilation. A cleaner design would be to have an empty stub for default_output_attributes in Oceananigans src which does nothing, then is extended by both OceananigansNCDatasetsExt and ClimaSeaIceNCDatasetsExt.

Full stacktrace

Failed to precompile ClimaOcean [0376089a-ecfe-4b0e-a64f-9c555d74d754] to "/Users/jsloan/.julia/compiled/v1.12/ClimaOcean/jl_jlrONG".
ERROR: LoadError: InitError: Evaluation into the closed module `ClimaSeaIceNCDatasetsExt` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `ClimaSeaIceNCDatasetsExt` with `eval` during precompilation - don't do this.
Stacktrace:
  [1] eval(m::Module, e::Any)
    @ Core ./boot.jl:489
  [2] __init__()
    @ ClimaSeaIceNCDatasetsExt ~/.julia/packages/ClimaSeaIce/NVDV8/ext/ClimaSeaIceNCDatasetsExt.jl:34
  [3] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1443
  [4] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1431
  [5] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any}; register::Bool)
    @ Base ./loading.jl:1319
  [6] _include_from_serialized
    @ ./loading.jl:1274 [inlined]
  [7] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT_PATH::Vector{String})
    @ Base ./loading.jl:2115
  [8] __require_prelocked(pkg::Base.PkgId, env::Nothing)
    @ Base ./loading.jl:2609
  [9] _require_prelocked(uuidkey::Base.PkgId, env::Nothing)
    @ Base ./loading.jl:2493
 [10] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:2487
 [11] run_extension_callbacks(extid::Base.ExtensionId)
    @ Base ./loading.jl:1607
 [12] run_extension_callbacks(pkgid::Base.PkgId)
    @ Base ./loading.jl:1644
 [13] run_package_callbacks(modkey::Base.PkgId)
    @ Base ./loading.jl:1460
 [14] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2501
 [15] macro expansion
    @ ./loading.jl:2421 [inlined]
 [16] macro expansion
    @ ./lock.jl:376 [inlined]
 [17] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2386
 [18] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2362
 [19] include(mapexpr::Function, mod::Module, _path::String)
    @ Base ./Base.jl:307
 [20] top-level scope
    @ ~/.julia/packages/ClimaOcean/o4hZ0/src/DataWrangling/DataWrangling.jl:199
 [21] include(mapexpr::Function, mod::Module, _path::String)
    @ Base ./Base.jl:307
 [22] top-level scope
    @ ~/.julia/packages/ClimaOcean/o4hZ0/src/ClimaOcean.jl:92
 [23] include(mod::Module, _path::String)
    @ Base ./Base.jl:306
 [24] 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:3024
 [25] top-level scope
    @ stdin:5
 [26] eval(m::Module, e::Any)
    @ Core ./boot.jl:489
 [27] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:2870
 [28] include_string
    @ ./loading.jl:2880 [inlined]
 [29] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:315
 [30] _start()
    @ Base ./client.jl:550
during initialization of module ClimaSeaIceNCDatasetsExt
in expression starting at /Users/jsloan/.julia/packages/ClimaOcean/o4hZ0/src/DataWrangling/metadata_field.jl:1
in expression starting at /Users/jsloan/.julia/packages/ClimaOcean/o4hZ0/src/DataWrangling/DataWrangling.jl:1
in expression starting at /Users/jsloan/.julia/packages/ClimaOcean/o4hZ0/src/ClimaOcean.jl:1
in expression starting at stdin:5

Metadata

Metadata

Assignees

No one assigned

    Labels

    🕷️ bugWhy doesn't my code work!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions