JuliaPackaging / JLLWrappers.jl

MIT License
9 stars 9 forks source link

Lazy artifacts are downloaded during pre-compilation by dependents #69

Open topolarity opened 1 month ago

topolarity commented 1 month ago

We recently tried to make IntelOpenMP_jll lazy (https://github.com/JuliaPackaging/Yggdrasil/pull/9319), but unfortunately we mostly failed:

(@v1.12) pkg> add MKL_jll
...
Precompiling packages finished.
  1 dependency successfully precompiled in 9 seconds. 24 already precompiled.
  1 dependency had output during precompilation:
┌ MKL_jll
│   Downloading artifact: IntelOpenMP
└

MKL_jll and IntelOpenMP_jll are both intended to be "lazy" - they should not download their artifacts unless at least one of them is triggered by a using at runtime.

However, IntelOpenMP is downloaded essentially because MKL_jll appears anywhere in your Manifest.

That's because the using (at precompile time) in MKL_jll implicitly triggers the lazy download, making it effectively eager (despite the fact that there's no runtime using here)

topolarity commented 1 month ago

Related(ish): https://github.com/JuliaPackaging/JLLWrappers.jl/issues/65

To solve this we might need a way to do the using ... without triggering the __init__ at pre-compilation time.

JLL's don't actually use their dependencies during (their own) pre-compilation, so they really don't need to run them - it's enough to defer the __init__ of their dependencies to when their own __init__ runs