StaticArrayInterface does not have LinearAlgebra in its dependencies

When running the script bin/create_sys_image from the package GitHub - aenarete/KiteControllers.jl: Controllers for airborne wind energy systems I get the following error:

✔ [07m:06s] PackageCompiler: compiling incremental system image
┌ Warning: Error requiring `StaticArrays` from `StaticArrayInterface`
│   exception =
│    LoadError: ArgumentError: Package StaticArrayInterface does not have LinearAlgebra in its dependencies:
│    - You may have a partially installed environment. Try `Pkg.instantiate()`
│      to ensure all packages in the environment are installed.
│    - Or, if you have StaticArrayInterface checked out for development and have
│      added LinearAlgebra as a dependency but haven't updated your primary
│      environment's manifest file, try `Pkg.resolve()`.
│    - Otherwise you may need to report an issue with StaticArrayInterface
│    Stacktrace:
│      [1] macro expansion
│        @ ./loading.jl:1167 [inlined]
│      [2] macro expansion
│        @ ./lock.jl:223 [inlined]
│      [3] require(into::Module, mod::Symbol)
│        @ Base ./loading.jl:1144
│      [4] include(mod::Module, _path::String)
│        @ Base ./Base.jl:419
│      [5] include(x::String)
│        @ StaticArrayInterface ~/.julia/packages/StaticArrayInterface/IzhAV/src/StaticArrayInterface.jl:1
│      [6] macro expansion
│        @ ~/.julia/packages/Requires/Z8rfN/src/Requires.jl:40 [inlined]
│      [7] top-level scope
│        @ ~/.julia/packages/StaticArrayInterface/IzhAV/src/StaticArrayInterface.jl:488
│      [8] eval
│        @ ./boot.jl:368 [inlined]
│      [9] eval
│        @ ~/.julia/packages/StaticArrayInterface/IzhAV/src/StaticArrayInterface.jl:1 [inlined]
│     [10] (::StaticArrayInterface.var"#55#61")()
│        @ StaticArrayInterface ~/.julia/packages/Requires/Z8rfN/src/require.jl:101
│     [11] macro expansion
│        @ ./timing.jl:382 [inlined]
│     [12] err(f::Any, listener::Module, modname::String, file::String, line::Any)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:47
│     [13] (::StaticArrayInterface.var"#54#60")()
│        @ StaticArrayInterface ~/.julia/packages/Requires/Z8rfN/src/require.jl:100
│     [14] withpath(f::Any, path::String)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:37
│     [15] (::StaticArrayInterface.var"#53#59")()
│        @ StaticArrayInterface ~/.julia/packages/Requires/Z8rfN/src/require.jl:99
│     [16] listenpkg(f::Any, pkg::Base.PkgId)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:20
│     [17] macro expansion
│        @ ~/.julia/packages/Requires/Z8rfN/src/require.jl:98 [inlined]
│     [18] __init__()
│        @ StaticArrayInterface ~/.julia/packages/StaticArrayInterface/IzhAV/src/StaticArrayInterface.jl:488
│    in expression starting at /home/ufechner/.julia/packages/StaticArrayInterface/IzhAV/ext/StaticArrayInterfaceStaticArraysExt.jl:1
└ @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:51
┌ Warning: Error requiring `OffsetArrays` from `StaticArrayInterface`
│   exception =
│    LoadError: ArgumentError: Package StaticArrayInterface does not have Static in its dependencies:
│    - You may have a partially installed environment. Try `Pkg.instantiate()`
│      to ensure all packages in the environment are installed.
│    - Or, if you have StaticArrayInterface checked out for development and have
│      added Static as a dependency but haven't updated your primary
│      environment's manifest file, try `Pkg.resolve()`.
│    - Otherwise you may need to report an issue with StaticArrayInterface
│    Stacktrace:
│      [1] macro expansion
│        @ ./loading.jl:1167 [inlined]
│      [2] macro expansion
│        @ ./lock.jl:223 [inlined]
│      [3] require(into::Module, mod::Symbol)
│        @ Base ./loading.jl:1144
│      [4] include(mod::Module, _path::String)
│        @ Base ./Base.jl:419
│      [5] include(x::String)
│        @ StaticArrayInterface ~/.julia/packages/StaticArrayInterface/IzhAV/src/StaticArrayInterface.jl:1
│      [6] macro expansion
│        @ ~/.julia/packages/Requires/Z8rfN/src/Requires.jl:40 [inlined]
│      [7] top-level scope
│        @ ~/.julia/packages/StaticArrayInterface/IzhAV/src/StaticArrayInterface.jl:489
│      [8] eval
│        @ ./boot.jl:368 [inlined]
│      [9] eval
│        @ ~/.julia/packages/StaticArrayInterface/IzhAV/src/StaticArrayInterface.jl:1 [inlined]
│     [10] (::StaticArrayInterface.var"#58#64")()
│        @ StaticArrayInterface ~/.julia/packages/Requires/Z8rfN/src/require.jl:101
│     [11] macro expansion
│        @ ./timing.jl:382 [inlined]
│     [12] err(f::Any, listener::Module, modname::String, file::String, line::Any)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:47
│     [13] (::StaticArrayInterface.var"#57#63")()
│        @ StaticArrayInterface ~/.julia/packages/Requires/Z8rfN/src/require.jl:100
│     [14] withpath(f::Any, path::String)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:37
│     [15] (::StaticArrayInterface.var"#56#62")()
│        @ StaticArrayInterface ~/.julia/packages/Requires/Z8rfN/src/require.jl:99
│     [16] listenpkg(f::Any, pkg::Base.PkgId)
│        @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:20
│     [17] macro expansion
│        @ ~/.julia/packages/Requires/Z8rfN/src/require.jl:98 [inlined]
│     [18] __init__()
│        @ StaticArrayInterface ~/.julia/packages/StaticArrayInterface/IzhAV/src/StaticArrayInterface.jl:489
│    in expression starting at /home/ufechner/.julia/packages/StaticArrayInterface/IzhAV/ext/StaticArrayInterfaceOffsetArraysExt.jl:1
└ @ Requires ~/.julia/packages/Requires/Z8rfN/src/require.jl:51

This is the code that gets executed:

# activate the test environment if needed
using Pkg
if ! ("Plots" ∈ keys(Pkg.project().dependencies))
    using TestEnv; TestEnv.activate()
    Pkg.resolve()
end

@info "Loading packages ..."
using BenchmarkTools, Plots, KiteUtils, NLsolve, Parameters, StaticArrays, WinchModels, PackageCompiler, KiteViewers, 
      KiteModels, KitePodModels, StructTypes, YAML

@info "Creating sysimage ..."
push!(LOAD_PATH,joinpath(pwd(),"src"))

PackageCompiler.create_sysimage(
    [:BenchmarkTools, :Plots, :KiteUtils, :NLsolve, :Parameters, :StaticArrays, :WinchModels, :KiteViewers, 
     :KiteModels, :KitePodModels, :StructTypes, :YAML];
    sysimage_path="kps-image_tmp.so",
    precompile_execution_file=joinpath("test", "test_for_precompile.jl")
)

Any idea what is going wrong?

Interesting, it’s definitely in there: StaticArrayInterface.jl/Project.toml at master · JuliaArrays/StaticArrayInterface.jl · GitHub

Well, I am not using the latest version of StaticArrays…

(jl_rLyQaR) pkg> st
Status `/tmp/jl_rLyQaR/Project.toml`
  [6e4b80f9] BenchmarkTools v1.3.2
  [d0351b0e] InspectDR v0.4.3
  [82f05805] Joysticks v0.1.4
  [b19fd437] KiteControllers v0.1.7 `~/repos/KiteControllers`
  [b94af626] KiteModels v0.4.7
  [9de5dc81] KitePodModels v0.2.1
  [90980105] KiteUtils v0.4.8
  [2e593061] KiteViewers v0.2.4
  [2774e3e8] NLsolve v4.5.1
⌅ [510215fc] Observables v0.4.0
  [9b87118b] PackageCompiler v2.1.5
  [d96e819e] Parameters v0.12.3
⌃ [91a5bcdd] Plots v1.32.0
⌅ [90137ffa] StaticArrays v1.5.12
  [856f2bd8] StructTypes v1.10.0
⌅ [1e6cf692] TestEnv v1.9.3
  [21f18d07] Timers v0.1.5
  [7dcfa46b] WinchModels v0.1.1
  [ddb6d928] YAML v0.4.8
  [de0858da] Printf `@stdlib/Printf`
  [8dfed614] Test `@stdlib/Test`

It’s saying StaticArrayInterface, and every release of the package has had it as a dep.

My guess is that it’s a bad interaction between Requires and system image building. Using v1.9 with its extensions might be the right thing to do here.

Adding StaticArrayInterface to Project.toml, to the “using” statement and to PackageCompiler.create_sysimage solved the issue. Is this to be expected, or is it a bug in PackageCompiler?

It must be some interaction between Requires and PackageCompiler

Files loaded by Requires should only load packages via using ..Package if it wants to be relocatable (and compatible with sysimages). That’s because these files are loaded at runtime.

So here it should use using ..LinearAlgebra.

1 Like

What do you mean with Requires ? Is it a package or a function? I am not aware that I am using Requires.

EDIT: Ok, now I see that it is a package used by StaticArrayInterface.

Is this what you’re saying? Fix Requires.jl fallback by ChrisRackauckas · Pull Request #22 · JuliaArrays/StaticArrayInterface.jl · GitHub

1 Like

Yes, I think that should improve things.

1 Like