Skip to content

Precompilation failure on modern DiffEqBase versions: UndefVarError: DefaultInit not defined #108

Description

@uliw

When using ODEInterfaceDiffEq (e.g., version v3.17.0) alongside modern versions of the SciML/DiffEqBase ecosystem (such as DiffEqBase v6.174+), precompilation fails with the following error:

WARNING: Imported binding DiffEqBase.DefaultInit was undeclared at import time during import to ODEInterfaceDiffEq.
ERROR: LoadError: UndefVarError: DefaultInit not defined in ODEInterfaceDiffEq
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/ODEInterfaceDiffEq/HJWJN/src/initialize.jl:14
Cause
In src/initialize.jl, the package tries to import DefaultInit from DiffEqBase:

julia

import DiffEqBase: DefaultInit
However, in modern versions of the SciML ecosystem, DefaultInit is defined in OrdinaryDiffEqCore (or OrdinaryDiffEq) rather than in DiffEqBase or SciMLBase. Since ODEInterfaceDiffEq does not depend on OrdinaryDiffEq, it cannot resolve the type.

Suggested Fix
Similar to how Sundials.jl defines its own IDADefaultInit, ODEInterfaceDiffEq can define its own DAE default initialization type locally to preserve the interface without requiring a dependency on OrdinaryDiffEq:

In src/initialize.jl, remove import DiffEqBase: DefaultInit and instead define it locally:
julia

struct DefaultInit <: DiffEqBase.DAEInitializationAlgorithm end
In src/solve.jl, update the default parameter in the solver signature from DiffEqBase.DefaultInit() to the locally defined DefaultInit():
diff

  •    initializealg = DiffEqBase.DefaultInit(),
    
  •    initializealg = DefaultInit(),
    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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