diff --git a/base/client.jl b/base/client.jl index 1b62f870ae1b8..eeb3128ea224f 100644 --- a/base/client.jl +++ b/base/client.jl @@ -426,6 +426,22 @@ function load_InteractiveUtils(mod::Module=Main) return Core.eval(mod, :(using Base.MainInclude.InteractiveUtils; Base.MainInclude.InteractiveUtils)) end +function load_LinearAlgebra(mod::Module=Main) + # load LinearAlgebra stdlib + if !isdefined(MainInclude, :LinearAlgebra) + try + let LinearAlgebra = Base.require_stdlib(Base.PkgId(Base.UUID((0x37e2e46d_f89d_539d,0xb4ee_838fcccc9c8e)), "LinearAlgebra")) + MainInclude.LinearAlgebra = LinearAlgebra + end + catch ex + @warn "Failed to import LinearAlgebra into module $mod" exception=(ex, catch_backtrace()) + return nothing + end + end + Core._using(mod, MainInclude.LinearAlgebra) + return MainInclude.LinearAlgebra +end + function load_REPL() # load interactive-only libraries try @@ -516,6 +532,7 @@ function run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, history_f fallback_repl = parse(Bool, get(ENV, "JULIA_FALLBACK_REPL", "false")) if !fallback_repl && interactive load_InteractiveUtils() + load_LinearAlgebra() REPL = REPL_MODULE_REF[] if REPL === Base load_REPL() diff --git a/base/sysimg.jl b/base/sysimg.jl index fd71544c205cc..269fa06a75c47 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -84,8 +84,8 @@ let stdlibs = [ # No dependencies :FileWatching, # used by loading.jl -- implicit assumption that init runs - :Libdl, # Transitive through LinAlg - :Artifacts, # Transitive through LinAlg + :Libdl, + :Artifacts, :SHA, # transitive through Random :Sockets, # used by stream.jl @@ -94,7 +94,7 @@ let # libblastrampoline_jll # 1-depth packages - :LinearAlgebra, # Commits type-piracy and GEMM + # :LinearAlgebra, # Commits type-piracy and GEMM :Random, # Can't be removed due to rand being exported by Base ] end diff --git a/stdlib/REPL/src/REPL.jl b/stdlib/REPL/src/REPL.jl index f1f23ab1c382d..397d8de82a916 100644 --- a/stdlib/REPL/src/REPL.jl +++ b/stdlib/REPL/src/REPL.jl @@ -820,11 +820,12 @@ setmodifiers!(c::REPLCompletionProvider, m::LineEdit.Modifiers) = c.modifiers = Set `mod` as the default contextual module in the REPL, both for evaluating expressions and printing them. """ -function activate(mod::Module=Main; interactive_utils::Bool=true) +function activate(mod::Module=Main; interactive_utils::Bool=true, linearalgebra::Bool=true) mistate = (Base.active_repl::LineEditREPL).mistate mistate === nothing && return nothing mistate.active_module = mod interactive_utils && Base.load_InteractiveUtils(mod) + linearalgebra && Base.load_LinearAlgebra(mod) return nothing end diff --git a/stdlib/stdlib.mk b/stdlib/stdlib.mk index 3184ac9c3305f..762f156dad707 100644 --- a/stdlib/stdlib.mk +++ b/stdlib/stdlib.mk @@ -1,6 +1,5 @@ STDLIBS_WITHIN_SYSIMG := \ - Artifacts FileWatching Libdl SHA libblastrampoline_jll OpenBLAS_jll Random \ - LinearAlgebra Sockets + Artifacts FileWatching Libdl SHA Random Sockets INDEPENDENT_STDLIBS := \ ArgTools Base64 CRC32c Dates DelimitedFiles Distributed Downloads Future \