Skip to content

Commit 7f1dfe4

Browse files
authored
stop assuming that you can mutate data structures in other packages at precompile time (#1252)
This code pattern is not valid w.r.t precompilation. It breaks if you build a sysimage and happen to have a valid precomple file locally for `libblastrampoline_jll`, it also doesn't work if the involved packages are used like normal packages (and are not in a sysimage). fixes #1246
1 parent 1ce8426 commit 7f1dfe4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/LinearAlgebra.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,10 @@ function lbt_openblas_onload_callback()
840840
end
841841
end
842842

843-
# If users want to lazily load a different BLAS, they'd need to either change this call, or
844-
# clear the datastructures modified by this call and call it again with their own.
845-
libblastrampoline_jll.add_dependency!(OpenBLAS_jll, libopenblas, lbt_openblas_onload_callback)
843+
function __init__()
844+
# If users want to lazily load a different BLAS, they'd need to either change this call, or
845+
# clear the datastructures modified by this call and call it again with their own.
846+
libblastrampoline_jll.add_dependency!(OpenBLAS_jll, libopenblas, lbt_openblas_onload_callback)
847+
end
848+
846849
end # module LinearAlgebra

0 commit comments

Comments
 (0)