Skip to content

Commit 87fcc6e

Browse files
committed
libblastrampoline_jll: Run __init__ eagerly
This allows LBT to be used during a sysimage (`--trim`) build.
1 parent fed86d9 commit 87fcc6e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,17 @@ function __init__()
5757
global libblastrampoline_path = string(libblastrampoline.path)
5858
global artifact_dir = dirname(Sys.BINDIR)
5959
LIBPATH[] = dirname(libblastrampoline_path)
60+
empty!(LIBPATH_list)
6061
push!(LIBPATH_list, LIBPATH[])
6162
end
6263

64+
# Running this __init__() eagerly initializes several of the above global
65+
# with build-time values (which are not correct to use at run-time), but
66+
# thankfully these will be reset by __init__() before they are used.
67+
#
68+
# This allows BLAS / LinearAlgebra to be used in a sysimage (`--trim`) build.
69+
__init__()
70+
6371
if Base.generating_output()
6472
precompile(eager_mode, ())
6573
precompile(is_available, ())

test/stdlib_dependencies.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ try
214214
prop = getproperty(m, prop_name)
215215
if isa(prop, Libdl.LazyLibrary)
216216
lib_path = dlpath(prop)
217-
lazy_lib_deps = strip_soversion.(basename.(dlpath.(prop.dependencies)))
217+
lazy_lib_deps = strip_soversion.(basename.(dlpath.(prop.dependencies())))
218218
real_lib_deps = filter(!is_system_lib, get_deps_objectfile(lib_path))
219219

220220
# See if there are missing dependencies in the lazy library deps

0 commit comments

Comments
 (0)