Skip to content

OptimizationBase (v2) fails to precompile #1056

@tkemmer

Description

@tkemmer

Describe the bug 🐞
Precompilation of OptimizationBase 2.13.0 fails due to duplicated definitions here

struct IncompatibleOptimizerError <: Exception
err::String
end
function Base.showerror(io::IO, e::IncompatibleOptimizerError)
print(io, e.err)
end

and
struct IncompatibleOptimizerError <: Exception
err::String
end
function Base.showerror(io::IO, e::IncompatibleOptimizerError)
print(io, e.err)
end

Expected behavior
The package should be precompilable.

Minimal Reproducible Example 👇

]precompile OptimizationBase

Error & Stacktrace ⚠️

WARNING: Method definition (::Type{OptimizationBase.IncompatibleOptimizerError})(String) in module OptimizationBase at /home/thomas/.julia/packages/OptimizationBase/5YqPi/src/solve.jl:5 overwritten at /home/thomas/.julia/packages/OptimizationBase/5YqPi/src/solve.jl:34.
ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
Status `~/test/Project.toml`
⌅ [bca83a33] OptimizationBase v2.13.0
  • Output of using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
Status `~/test/Manifest.toml`
  [47edcb42] ADTypes v1.18.0         
  [7d9f7c33] Accessors v0.1.42
  [79e6a3ab] Adapt v4.4.0
  [4fba245c] ArrayInterface v7.20.0
  [38540f10] CommonSolve v0.2.4
  [a33af91c] CompositionsBase v0.1.2
  [187b0558] ConstructionBase v1.6.0
  [a0c0ee7d] DifferentiationInterface v0.7.9
  [ffbed154] DocStringExtensions v0.9.5
  [4e289a0a] EnumX v1.0.5
  [e2ba6199] ExprTools v0.1.10
  [55351af7] ExproniconLite v0.10.14
  [9aa1b823] FastClosures v0.3.2
  [1a297f60] FillArrays v1.14.0
  [069b7b12] FunctionWrappers v1.1.3
  [77dc65aa] FunctionWrappersWrappers v0.1.3
  [46192b85] GPUArraysCore v0.2.0
  [3587e190] InverseFunctions v0.1.17
  [82899510] IteratorInterfaceExtensions v1.0.0
  [ae98c720] Jieko v0.2.1
  [1914dd2f] MacroTools v0.5.16
  [2e0e35c7] Moshi v0.3.7
⌅ [bca83a33] OptimizationBase v2.13.0
  [90014a1f] PDMats v0.11.35
  [d236fae5] PreallocationTools v0.4.34
  [aea7be01] PrecompileTools v1.3.3
  [21216c6a] Preferences v1.5.0
  [3cdcf5f2] RecipesBase v1.3.4
  [731186ca] RecursiveArrayTools v3.37.1
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.1
  [7e49a35a] RuntimeGeneratedFunctions v0.5.15
  [0bca4576] SciMLBase v2.121.1
  [c0aeaf25] SciMLOperators v1.9.0
  [53ae85a6] SciMLStructures v1.7.0
  [9f842d2f] SparseConnectivityTracer v1.1.1
  [0a514795] SparseMatrixColorings v0.4.21
  [1e83bf80] StaticArraysCore v1.4.3
  [10745b16] Statistics v1.11.1
  [2efcf032] SymbolicIndexingInterface v0.3.45
  [56f22d72] Artifacts v1.11.0
  [2a0f44e3] Base64 v1.11.0
  [ade2ca70] Dates v1.11.0
  [8ba89e20] Distributed v1.11.0
  [ac6e5ff7] JuliaSyntaxHighlighting v1.12.0
  [8f399da3] Libdl v1.11.0
  [37e2e46d] LinearAlgebra v1.12.0
  [56ddb016] Logging v1.11.0
  [d6f4376e] Markdown v1.11.0
  [de0858da] Printf v1.11.0
  [9a3f8284] Random v1.11.0
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization v1.11.0
  [6462fe0b] Sockets v1.11.0
  [2f01184e] SparseArrays v1.12.0
  [f489334b] StyledStrings v1.11.0
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML v1.0.3
  [cf7118a7] UUIDs v1.11.0
  [4ec0a83e] Unicode v1.11.0
  [e66e0078] CompilerSupportLibraries_jll v1.3.0+1
  [4536629a] OpenBLAS_jll v0.3.29+0
  [bea87d4a] SuiteSparse_jll v7.8.3+2
  [8e850b90] libblastrampoline_jll v5.13.1+1
  • Output of versioninfo()
Julia Version 1.12.0
Commit b907bd0600f (2025-10-07 15:42 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 9700X 8-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver5)
  GC: Built with stock GC
Threads: 16 default, 1 interactive, 16 GC (on 16 virtual cores)
Environment:
  JULIA_NUM_PRECOMPILE_TASKS = 16
  JULIA_NUM_THREADS = 16

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions