[SOLVED] Precompilation of OrdinaryDiffEq fails in julia 1.8.5 on manjaro (arch) linux

Dear Community,

I am relatively new to julia and want to model ordinary differential equations. Installing the OrdinaryDiffEq package failed, and the output of julia> import Pkg; Pkg.precompile() is:

julia> import Pkg; Pkg.precompile()
Precompiling project...
  ✗ LinearSolve
  ✗ NonlinearSolve
  ✗ OrdinaryDiffEq
  0 dependencies successfully precompiled in 37 seconds. 123 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

OrdinaryDiffEq [1dea7af3-3e70-54e6-95c3-0bf5283fa5ed]

Failed to precompile OrdinaryDiffEq [1dea7af3-3e70-54e6-95c3-0bf5283fa5ed] to /home/severin/.julia/compiled/v1.8/OrdinaryDiffEq/jl_1F51NA.
ERROR: LoadError: MethodError: convert(::Type{Union{}}, ::SparseArrays.SparseMatrixCSC{Float64, Int64}) is ambiguous. Candidates:
  convert(T::Type{<:LinearAlgebra.LowerTriangular}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:753
  convert(T::Type{<:SparseArrays.SparseVector}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsevector.jl:466
  convert(T::Type{<:LinearAlgebra.SymTridiagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:749
  convert(T::Type{<:LinearAlgebra.Bidiagonal}, m::AbstractMatrix) in LinearAlgebra at /usr/share/julia/stdlib/v1.8/LinearAlgebra/src/bidiag.jl:203
  convert(T::Type{<:LinearAlgebra.Tridiagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:751
  convert(T::Type{<:SparseArrays.AbstractSparseMatrixCSC}, m::AbstractMatrix) in SparseArrays at /usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:745
  convert(T::Type{<:LinearAlgebra.UpperTriangular}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:755
  convert(T::Type{<:LinearAlgebra.Diagonal}, m::SparseArrays.AbstractSparseMatrixCSC) in SparseArrays at /usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:747
  convert(::Type{Union{}}, a::AbstractArray) in Base at array.jl:618
  convert(T::Type{<:BitArray}, a::AbstractArray) in Base at bitarray.jl:580
  convert(::Type{T}, M::AbstractArray) where T<:OffsetArrays.OffsetArray in OffsetArrays at /home/severin/.julia/packages/OffsetArrays/TcCEq/src/OffsetArrays.jl:256
  convert(::Type{T}, a::AbstractArray) where T<:Array in Base at array.jl:617
  convert(::Type{SA}, a::AbstractArray) where SA<:StaticArraysCore.StaticArray in StaticArrays at /home/severin/.julia/packages/StaticArrays/jA1zK/src/convert.jl:194
  convert(::Type{Union{}}, x) in Base at essentials.jl:213
  convert(::Type{T}, obj) where T<:FunctionWrappers.FunctionWrapper in FunctionWrappers at /home/severin/.julia/packages/FunctionWrappers/Q5cBx/src/FunctionWrappers.jl:113
  convert(::Type{T}, arg) where T<:VecElement in Base at baseext.jl:19
Possible fix, define
  convert(::Type{Union{}}, ::SparseArrays.AbstractSparseMatrixCSC)
Stacktrace:
  [1] Sparspak.SpkSparseSolver.SparseSolver{Int64, Float64}(p::SparseArrays.SparseMatrixCSC{Float64, Int64}, slvr::Sparspak.SpkSparseBase._SparseBase{Int64, Float64}, n::Int64, ma::Int64, na::Int64, mc::Int64, nc::Int64, _inmatrixdone::Bool, _orderdone::Bool, _symbolicdone::Bool, _factordone::Bool, _trisolvedone::Bool, _refinedone::Bool, _condestdone::Bool) (repeats 2 times)
    @ Sparspak.SpkSparseSolver ~/.julia/packages/Sparspak/ZSfSg/src/SparseMethod/SpkSparseSolver.jl:18
  [2] Sparspak.SpkSparseSolver.SparseSolver(m::SparseArrays.SparseMatrixCSC{Float64, Int64})
    @ Sparspak.SparseCSCInterface ~/.julia/packages/Sparspak/ZSfSg/src/SparseCSCInterface/SparseCSCInterface.jl:189
  [3] sparspaklu(m::SparseArrays.SparseMatrixCSC{Float64, Int64}; factorize::Bool)
    @ Sparspak.SparseCSCInterface ~/.julia/packages/Sparspak/ZSfSg/src/SparseCSCInterface/SparseCSCInterface.jl:219
  [4] init_cacheval(#unused#::LinearSolve.SparspakFactorization, A::SparseArrays.SparseMatrixCSC{Float64, Int64}, b::Vector{Float64}, u::Vector{Float64}, Pl::IterativeSolvers.Identity, Pr::IterativeSolvers.Identity, maxiters::Int64, abstol::Float64, reltol::Float64, verbose::Bool, assumptions::LinearSolve.OperatorAssumptions{Nothing})
    @ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/factorization.jl:514
  [5] init(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization; alias_A::Bool, alias_b::Bool, abstol::Float64, reltol::Float64, maxiters::Int64, verbose::Bool, Pl::IterativeSolvers.Identity, Pr::IterativeSolvers.Identity, assumptions::LinearSolve.OperatorAssumptions{Nothing}, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/common.jl:117
  [6] init(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization)
    @ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/common.jl:88
  [7] solve(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/common.jl:157
  [8] solve(::SciMLBase.LinearProblem{Nothing, true, SparseArrays.SparseMatrixCSC{Float64, Int64}, Vector{Float64}, SciMLBase.NullParameters, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, ::LinearSolve.SparspakFactorization)
    @ LinearSolve ~/.julia/packages/LinearSolve/dxfUd/src/common.jl:154
  [9] macro expansion
    @ ~/.julia/packages/LinearSolve/dxfUd/src/LinearSolve.jl:92 [inlined]
 [10] top-level scope
    @ ~/.julia/packages/SnoopPrecompile/1XXT1/src/SnoopPrecompile.jl:62
 [11] top-level scope
    @ stdin:1
in expression starting at /home/severin/.julia/packages/LinearSolve/dxfUd/src/LinearSolve.jl:1
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile LinearSolve [7ed4a6bd-45f5-4d41-b270-4a48e9bafcae] to /home/severin/.julia/compiled/v1.8/LinearSolve/jl_bHyaCx.
Stacktrace:
 [1] top-level scope
   @ stdin:1
in expression starting at /home/severin/.julia/packages/OrdinaryDiffEq/pIBDs/src/OrdinaryDiffEq.jl:1
in expression starting at stdin:1
Stacktrace:
 [1] top-level scope
   @ REPL[7]:1

julia> 

I somehow suspect the (communication with the) suite sparse manjaro package, because this package was just updated today, and installation of OrdinaryDiffEq was impossible at all before the update. On the other hand, the error message suggests an error in some julia code to me…

I would appreciate if someone could help me. I don’t know it this is helpful, but the output of versioninfo() is

julia> versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65e* (2023-01-08 06:45 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: 12 × Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, skylake)
  Threads: 1 on 12 virtual cores
Environment:
  LD_LIBRARY_PATH = /usr/lib/julia

julia> 

Thank you!
Cheers
Severin

The problem appeared to be with the manjaro julia package (version 2:1.8.5-2) in the community repository. I installed version 1.8.5-1 from AUR and it worked

For posterity - this is known and the recommended solution in the arch wiki:

https://wiki.archlinux.org/title/Julia

The source of the issue is that arch/manjaro doesn’t ship the vendored libraries, like LLVM, julia usually uses. Julia vendors these because of various patches that are required for julia to function, that have not yet been merged upstream.