Extension cycles are problematic (long precompile
times, difficult to understand/resolve) #55557
Closed
Description
The attached test package imports many packages, including ModelingToolkit which currently has a circular dependency among its extensions. In a case with circular deps like this, pkg> precompile
seems to be much less successful on 1.10.5 (which back-ported circularity detection) vs. 1.10.4
A locally-built v1.10.5 shows the warning regarding the circularity:
(Circularity_MWE) pkg> precompile
┌ Warning: Circular dependency detected. Precompilation will be skipped for:
│ ModelingToolkitStandardLibrary [16a59e39-deab-5bd0-87e4-056b12336739]
│ NonlinearSolve [8913a72c-1f9b-4ce2-8d82-65094dcecaec]
...
│ BoundaryValueDiffEq [764a87c0-6b3e-53db-9096-fe964310641d]
│ ManifoldsBoundaryValueDiffEqExt [eb713886-0b96-5c41-a09d-5e8967e02f7d]
└ @ Pkg.API ~/repos/julia/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:1279
...
342 dependencies successfully precompiled in 294 seconds. 31 skipped due to circular dependency.
The using Circularity_MWE
message is quite scary and cryptic:
┌ Warning: Module SymbolicsPreallocationToolsExt with build ID ffffffff-ffff-ffff-0000-6f7fcf83bfa3 is missing from the cache.
│ This may mean SymbolicsPreallocationToolsExt [d479e226-fb54-5ebe-a75e-a7af7f39127f] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:1948
┌ Error: Error during loading of extension SymbolicsPreallocationToolsExt of Symbolics, use `Base.retry_load_extensions()` to retry.
│ exception =
│ 1-element ExceptionStack:
│ Declaring __precompile__(false) is not allowed in files that are being precompiled.
│ Stacktrace:
│ [1] _require(pkg::Base.PkgId, env::Nothing)
│ @ Base ./loading.jl:1952
... (many stack frames skipped)
The real problem though, is it takes about 25 minutes for the first using X
to complete on my machine:
$ time julia --project=Circularity_MWE -e "using Circularity_MWE"
2076.34s user 31.37s system 139% cpu 24:53.46 total
On v1.10.4, this takes ~10 seconds.
Related: #55543