diff --git a/stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl b/stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl index 1f5c34c9c10ee..853d5eea5367e 100644 --- a/stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl +++ b/stdlib/CompilerSupportLibraries_jll/src/CompilerSupportLibraries_jll.jl @@ -64,13 +64,24 @@ if @isdefined(_libatomic_path) const libatomic = LazyLibrary(_libatomic_path) end const libgcc_s = LazyLibrary(_libgcc_s_path) -libgfortran_deps = [libgcc_s] + +_libgfortran_deps = [libgcc_s] if @isdefined _libquadmath_path const libquadmath = LazyLibrary(_libquadmath_path) - push!(libgfortran_deps, libquadmath) + push!(_libgfortran_deps, libquadmath) end -const libgfortran = LazyLibrary(_libgfortran_path, dependencies=libgfortran_deps) -const libstdcxx = LazyLibrary(_libstdcxx_path, dependencies=[libgcc_s]) + +const libgfortran = LazyLibrary(_libgfortran_path, dependencies=_libgfortran_deps) + +_libstdcxx_dependencies = LazyLibrary[libgcc_s] +const libstdcxx = LazyLibrary(_libstdcxx_path, dependencies=_libstdcxx_dependencies) + +if Sys.isfreebsd() + _libstdcxx_dependencies = LazyLibrary[] +else + _libstdcxx_dependencies = LazyLibrary[] +end + const libgomp = LazyLibrary(_libgomp_path) # Some installations (such as those from-source) may not have `libssp` @@ -116,4 +127,9 @@ function __init__() push!(LIBPATH_list, LIBPATH[]) end +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end + end # module CompilerSupportLibraries_jll diff --git a/stdlib/GMP_jll/Project.toml b/stdlib/GMP_jll/Project.toml index a31688d0a9c07..c17e5311a7d80 100644 --- a/stdlib/GMP_jll/Project.toml +++ b/stdlib/GMP_jll/Project.toml @@ -4,6 +4,7 @@ version = "6.3.0+2" [deps] Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +CompilerSupportLibraries_jll = "e66e0078-7015-5450-92f7-15fbd957f2ae" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" [compat] diff --git a/stdlib/GMP_jll/src/GMP_jll.jl b/stdlib/GMP_jll/src/GMP_jll.jl index ae8b3c0b3e7d5..b75488807e383 100644 --- a/stdlib/GMP_jll/src/GMP_jll.jl +++ b/stdlib/GMP_jll/src/GMP_jll.jl @@ -2,51 +2,60 @@ ## dummy stub for https://github.com/JuliaBinaryWrappers/GMP_jll.jl baremodule GMP_jll -using Base, Libdl - -const PATH_list = String[] -const LIBPATH_list = String[] +using Base, Libdl, CompilerSupportLibraries_jll export libgmp, libgmpxx # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libgmp_handle::Ptr{Cvoid} = C_NULL libgmp_path::String = "" -libgmpxx_handle::Ptr{Cvoid} = C_NULL libgmpxx_path::String = "" if Sys.iswindows() - const libgmp = "libgmp-10.dll" - const libgmpxx = "libgmpxx-4.dll" + const _libgmp_path = BundledLazyLibraryPath("libgmp-10.dll") + const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx-4.dll") elseif Sys.isapple() - const libgmp = "@rpath/libgmp.10.dylib" - const libgmpxx = "@rpath/libgmpxx.4.dylib" + const _libgmp_path = BundledLazyLibraryPath("libgmp.10.dylib") + const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx.4.dylib") else - const libgmp = "libgmp.so.10" - const libgmpxx = "libgmpxx.so.4" + const _libgmp_path = BundledLazyLibraryPath("libgmp.so.10") + const _libgmpxx_path = BundledLazyLibraryPath("libgmpxx.so.4") end +const libgmp = LazyLibrary(_libgmp_path) + +if Sys.isapple() + _libgmpxx_dependencies = LazyLibrary[libgmp] +else + _libgmpxx_dependencies = LazyLibrary[libgmp, libstdcxx, libgcc_s] +end +const libgmpxx = LazyLibrary( + _libgmpxx_path, + dependencies=_libgmpxx_dependencies, +) + +function eager_mode() + CompilerSupportLibraries_jll.eager_mode() + dlopen(libgmp) + dlopen(libgmpxx) +end +is_available() = true + function __init__() - global libgmp_handle = dlopen(libgmp) - global libgmp_path = dlpath(libgmp_handle) - global libgmpxx_handle = dlopen(libgmpxx) - global libgmpxx_path = dlpath(libgmpxx_handle) + global libgmp_path = string(_libgmp_path) + global libgmpxx_path = string(_libgmpxx_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libgmp_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libgmp_path() = libgmp_path -get_libgmpxx_path() = libgmpxx_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module GMP_jll diff --git a/stdlib/GMP_jll/test/runtests.jl b/stdlib/GMP_jll/test/runtests.jl index b2b35b98cbe17..ad0e2dc8a4944 100644 --- a/stdlib/GMP_jll/test/runtests.jl +++ b/stdlib/GMP_jll/test/runtests.jl @@ -3,6 +3,6 @@ using Test, Libdl, GMP_jll @testset "GMP_jll" begin - vn = VersionNumber(unsafe_string(unsafe_load(cglobal((:__gmp_version, libgmp), Ptr{Cchar})))) + vn = VersionNumber(unsafe_string(unsafe_load(cglobal(dlsym(libgmp, :__gmp_version), Ptr{Cchar})))) @test vn == v"6.3.0" end diff --git a/stdlib/LLVMLibUnwind_jll/src/LLVMLibUnwind_jll.jl b/stdlib/LLVMLibUnwind_jll/src/LLVMLibUnwind_jll.jl index 429e35b91d3f2..4adae99c520d4 100644 --- a/stdlib/LLVMLibUnwind_jll/src/LLVMLibUnwind_jll.jl +++ b/stdlib/LLVMLibUnwind_jll/src/LLVMLibUnwind_jll.jl @@ -5,38 +5,33 @@ baremodule LLVMLibUnwind_jll using Base, Libdl -const PATH_list = String[] -const LIBPATH_list = String[] - export llvmlibunwind # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -llvmlibunwind_handle::Ptr{Cvoid} = C_NULL llvmlibunwind_path::String = "" -const llvmlibunwind = "libunwind" +const _llvmlibunwind_path = BundledLazyLibraryPath("libunwind") +const llvmlibunwind = LazyLibrary(_llvmlibunwind_path) +function eager_mode() + dlopen(llvmlibunwind) +end +is_available() = @static Sys.isapple() ? true : false function __init__() - # We only dlopen something on MacOS - @static if Sys.isapple() - global llvmlibunwind_handle = dlopen(llvmlibunwind) - global llvmlibunwind_path = dlpath(llvmlibunwind_handle) - global artifact_dir = dirname(Sys.BINDIR) - LIBPATH[] = dirname(llvmlibunwind_path) - push!(LIBPATH_list, LIBPATH[]) - end + global llvmlibunwind_path = string(_llvmlibunwind_path) + global artifact_dir = dirname(Sys.BINDIR) + LIBPATH[] = dirname(llvmlibunwind_path) + push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = @static Sys.isapple() ? true : false -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_llvmlibunwind_path() = llvmlibunwind_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module LLVMLibUnwind_jll diff --git a/stdlib/LLVMLibUnwind_jll/test/runtests.jl b/stdlib/LLVMLibUnwind_jll/test/runtests.jl index e984593ab2c25..42afe50a875f6 100644 --- a/stdlib/LLVMLibUnwind_jll/test/runtests.jl +++ b/stdlib/LLVMLibUnwind_jll/test/runtests.jl @@ -1,16 +1,14 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -using Test, Libdl -using LLVMLibUnwind_jll: llvmlibunwind_handle - +using Test, Libdl, LLVMLibUnwind_jll @testset "LLVMLibUnwind_jll" begin if Sys.isapple() - @test dlsym(llvmlibunwind_handle, :unw_getcontext; throw_error=false) !== nothing - @test dlsym(llvmlibunwind_handle, :unw_init_local; throw_error=false) !== nothing - @test dlsym(llvmlibunwind_handle, :unw_init_local_dwarf; throw_error=false) !== nothing - @test dlsym(llvmlibunwind_handle, :unw_step; throw_error=false) !== nothing - @test dlsym(llvmlibunwind_handle, :unw_get_reg; throw_error=false) !== nothing - @test dlsym(llvmlibunwind_handle, :unw_set_reg; throw_error=false) !== nothing - @test dlsym(llvmlibunwind_handle, :unw_resume; throw_error=false) !== nothing + @test dlsym(llvmlibunwind, :unw_getcontext; throw_error=false) !== nothing + @test dlsym(llvmlibunwind, :unw_init_local; throw_error=false) !== nothing + @test dlsym(llvmlibunwind, :unw_init_local_dwarf; throw_error=false) !== nothing + @test dlsym(llvmlibunwind, :unw_step; throw_error=false) !== nothing + @test dlsym(llvmlibunwind, :unw_get_reg; throw_error=false) !== nothing + @test dlsym(llvmlibunwind, :unw_set_reg; throw_error=false) !== nothing + @test dlsym(llvmlibunwind, :unw_resume; throw_error=false) !== nothing end end diff --git a/stdlib/LibCURL_jll/src/LibCURL_jll.jl b/stdlib/LibCURL_jll/src/LibCURL_jll.jl index 5c1c2aa14b23a..92af7af03881c 100644 --- a/stdlib/LibCURL_jll/src/LibCURL_jll.jl +++ b/stdlib/LibCURL_jll/src/LibCURL_jll.jl @@ -9,41 +9,52 @@ if !(Sys.iswindows() || Sys.isapple()) using OpenSSL_jll end -const PATH_list = String[] -const LIBPATH_list = String[] - export libcurl # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libcurl_handle::Ptr{Cvoid} = C_NULL libcurl_path::String = "" +_libcurl_dependencies = LazyLibrary[libz, libnghttp2, libssh2] +if !(Sys.iswindows() || Sys.isapple()) + append!(_libcurl_dependencies, [libssl, libcrypto]) +end + if Sys.iswindows() - const libcurl = "libcurl-4.dll" + const _libcurl_path = BundledLazyLibraryPath("libcurl-4.dll") elseif Sys.isapple() - const libcurl = "@rpath/libcurl.4.dylib" + const _libcurl_path = BundledLazyLibraryPath("libcurl.4.dylib") else - const libcurl = "libcurl.so.4" + const _libcurl_path = BundledLazyLibraryPath("libcurl.so.4") end +const libcurl = LazyLibrary( + _libcurl_path, + dependencies=_libcurl_dependencies, +) + +function eager_mode() + Zlib_jll.eager_mode() + nghttp2_jll.eager_mode() + LibSSH2_jll.eager_mode() + dlopen(libcurl) +end +is_available() = true + function __init__() - global libcurl_handle = dlopen(libcurl) - global libcurl_path = dlpath(libcurl_handle) + global libcurl_path = string(_libcurl_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libcurl_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libcurl_path() = libcurl_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module LibCURL_jll diff --git a/stdlib/LibGit2_jll/src/LibGit2_jll.jl b/stdlib/LibGit2_jll/src/LibGit2_jll.jl index c69deb4a9d932..68e6dfba6d0c0 100644 --- a/stdlib/LibGit2_jll/src/LibGit2_jll.jl +++ b/stdlib/LibGit2_jll/src/LibGit2_jll.jl @@ -9,41 +9,46 @@ if !(Sys.iswindows() || Sys.isapple()) using OpenSSL_jll end -const PATH_list = String[] -const LIBPATH_list = String[] - export libgit2 # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libgit2_handle::Ptr{Cvoid} = C_NULL libgit2_path::String = "" if Sys.iswindows() - const libgit2 = "libgit2.dll" + const _libgit2_path = BundledLazyLibraryPath("libgit2.dll") elseif Sys.isapple() - const libgit2 = "@rpath/libgit2.1.9.dylib" + const _libgit2_path = BundledLazyLibraryPath("libgit2.1.9.dylib") else - const libgit2 = "libgit2.so.1.9" + const _libgit2_path = BundledLazyLibraryPath("libgit2.so.1.9") end +_libgit2_dependencies = LazyLibrary[libssh2] +const libgit2 = LazyLibrary(_libgit2_path, dependencies=_libgit2_dependencies) + +function eager_mode() + LibSSH2_jll.eager_mode() + @static if !(Sys.iswindows() || Sys.isapple()) + OpenSSL_jll.eager_mode() + end + dlopen(libgit2) +end +is_available() = true + function __init__() - global libgit2_handle = dlopen(libgit2) - global libgit2_path = dlpath(libgit2_handle) + global libgit2_path = string(_libgit2_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libgit2_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libgit2_path() = libgit2_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module LibGit2_jll diff --git a/stdlib/LibSSH2_jll/Project.toml b/stdlib/LibSSH2_jll/Project.toml index 09f07b559344c..f535847ae2f29 100644 --- a/stdlib/LibSSH2_jll/Project.toml +++ b/stdlib/LibSSH2_jll/Project.toml @@ -6,6 +6,7 @@ version = "1.11.3+1" OpenSSL_jll = "458c3c95-2e84-50aa-8efc-19380b2a3a95" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a" [compat] julia = "1.8" diff --git a/stdlib/LibSSH2_jll/src/LibSSH2_jll.jl b/stdlib/LibSSH2_jll/src/LibSSH2_jll.jl index e9392fe34a918..b82bd9fd3185d 100644 --- a/stdlib/LibSSH2_jll/src/LibSSH2_jll.jl +++ b/stdlib/LibSSH2_jll/src/LibSSH2_jll.jl @@ -3,48 +3,58 @@ ## dummy stub for https://github.com/JuliaBinaryWrappers/LibSSH2_jll.jl baremodule LibSSH2_jll -using Base, Libdl +using Base, Libdl, Zlib_jll if !Sys.iswindows() # On Windows we use system SSL/crypto libraries using OpenSSL_jll end -const PATH_list = String[] -const LIBPATH_list = String[] - export libssh2 # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libssh2_handle::Ptr{Cvoid} = C_NULL libssh2_path::String = "" + if Sys.iswindows() - const libssh2 = "libssh2.dll" + const _libssh2_path = BundledLazyLibraryPath("libssh2.dll") + _libssh2_dependencies = LazyLibrary[] elseif Sys.isapple() - const libssh2 = "@rpath/libssh2.1.dylib" + const _libssh2_path = BundledLazyLibraryPath("libssh2.1.dylib") + _libssh2_dependencies = LazyLibrary[libz, libcrypto] +elseif Sys.isfreebsd() + const _libssh2_path = BundledLazyLibraryPath("libssh2.so.1") + _libssh2_dependencies = LazyLibrary[] else - const libssh2 = "libssh2.so.1" + const _libssh2_path = BundledLazyLibraryPath("libssh2.so.1") + _libssh2_dependencies = LazyLibrary[libcrypto] end +const libssh2 = LazyLibrary(_libssh2_path, dependencies=_libssh2_dependencies) + +function eager_mode() + Zlib_jll.eager_mode() + @static if !Sys.iswindows() + OpenSSL_jll.eager_mode() + end + dlopen(libssh2) +end +is_available() = true + function __init__() - global libssh2_handle = dlopen(libssh2) - global libssh2_path = dlpath(libssh2_handle) + global libssh2_path = string(_libssh2_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libssh2_path) push!(LIBPATH_list, LIBPATH[]) end - -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libssh2_path() = libssh2_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module LibSSH2_jll diff --git a/stdlib/LibUV_jll/src/LibUV_jll.jl b/stdlib/LibUV_jll/src/LibUV_jll.jl index febc47f168ab9..5bf9b7ef3b0fb 100644 --- a/stdlib/LibUV_jll/src/LibUV_jll.jl +++ b/stdlib/LibUV_jll/src/LibUV_jll.jl @@ -6,5 +6,6 @@ baremodule LibUV_jll using Base, Libdl # NOTE: This file is currently empty, as we link libuv statically for now. +is_available() = true end # module LibUV_jll diff --git a/stdlib/LibUnwind_jll/Project.toml b/stdlib/LibUnwind_jll/Project.toml index b43f1c537ce5a..8e6ba70a3deb3 100644 --- a/stdlib/LibUnwind_jll/Project.toml +++ b/stdlib/LibUnwind_jll/Project.toml @@ -3,8 +3,10 @@ uuid = "745a5e78-f969-53e9-954f-d19f2f74f4e3" version = "1.8.1+2" [deps] -Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +CompilerSupportLibraries_jll = "e66e0078-7015-5450-92f7-15fbd957f2ae" +Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a" [compat] julia = "1.6" diff --git a/stdlib/LibUnwind_jll/src/LibUnwind_jll.jl b/stdlib/LibUnwind_jll/src/LibUnwind_jll.jl index f97b18443b6fd..29659a18df0e0 100644 --- a/stdlib/LibUnwind_jll/src/LibUnwind_jll.jl +++ b/stdlib/LibUnwind_jll/src/LibUnwind_jll.jl @@ -4,39 +4,46 @@ baremodule LibUnwind_jll using Base, Libdl - -const PATH_list = String[] -const LIBPATH_list = String[] +using CompilerSupportLibraries_jll +using Zlib_jll export libunwind # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libunwind_handle::Ptr{Cvoid} = C_NULL libunwind_path::String = "" -const libunwind = "libunwind.so.8" +const _libunwind_path = BundledLazyLibraryPath("libunwind.so.8") + +if Sys.isfreebsd() + _libunwind_dependencies = LazyLibrary[libz] +else + _libunwind_dependencies = LazyLibrary[libgcc_s, libz] +end +const libunwind = LazyLibrary(_libunwind_path, dependencies=_libunwind_dependencies) + + +function eager_mode() + CompilerSupportLibraries_jll.eager_mode() + Zlib_jll.eager_mode() + dlopen(libunwind) +end +is_available() = @static(Sys.islinux() || Sys.isfreebsd()) ? true : false function __init__() - # We only do something on Linux/FreeBSD - @static if Sys.islinux() || Sys.isfreebsd() - global libunwind_handle = dlopen(libunwind) - global libunwind_path = dlpath(libunwind_handle) - global artifact_dir = dirname(Sys.BINDIR) - LIBPATH[] = dirname(libunwind_path) - push!(LIBPATH_list, LIBPATH[]) - end + global libunwind_path = string(_libunwind_path) + global artifact_dir = dirname(Sys.BINDIR) + LIBPATH[] = dirname(libunwind_path) + push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = @static (Sys.islinux() || Sys.isfreebsd()) ? true : false -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libunwind_path() = libunwind_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module LibUnwind_jll diff --git a/stdlib/LibUnwind_jll/test/runtests.jl b/stdlib/LibUnwind_jll/test/runtests.jl index 1cb33dd6729e3..c87ccad988dec 100644 --- a/stdlib/LibUnwind_jll/test/runtests.jl +++ b/stdlib/LibUnwind_jll/test/runtests.jl @@ -4,6 +4,6 @@ using Test, Libdl, LibUnwind_jll @testset "LibUnwind_jll" begin if !Sys.isapple() && !Sys.iswindows() - @test dlsym(LibUnwind_jll.libunwind_handle, :unw_backtrace; throw_error=false) !== nothing + @test dlsym(LibUnwind_jll.libunwind, :unw_backtrace; throw_error=false) !== nothing end end diff --git a/stdlib/MPFR_jll/src/MPFR_jll.jl b/stdlib/MPFR_jll/src/MPFR_jll.jl index 219ab0cad41be..58c79d1ab87ff 100644 --- a/stdlib/MPFR_jll/src/MPFR_jll.jl +++ b/stdlib/MPFR_jll/src/MPFR_jll.jl @@ -4,41 +4,38 @@ baremodule MPFR_jll using Base, Libdl, GMP_jll -const PATH_list = String[] -const LIBPATH_list = String[] - export libmpfr # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libmpfr_handle::Ptr{Cvoid} = C_NULL libmpfr_path::String = "" if Sys.iswindows() - const libmpfr = "libmpfr-6.dll" + const _libmpfr_path = BundledLazyLibraryPath("libmpfr-6.dll") elseif Sys.isapple() - const libmpfr = "@rpath/libmpfr.6.dylib" + const _libmpfr_path = BundledLazyLibraryPath("libmpfr.6.dylib") else - const libmpfr = "libmpfr.so.6" + const _libmpfr_path = BundledLazyLibraryPath("libmpfr.so.6") +end + +_libmpfr_dependencies = LazyLibrary[libgmp] + +const libmpfr = LazyLibrary(_libmpfr_path, dependencies=_libmpfr_dependencies) + +function eager_mode() + dlopen(libmpfr) end +is_available() = true function __init__() - global libmpfr_handle = dlopen(libmpfr) - global libmpfr_path = dlpath(libmpfr_handle) + global libmpfr_path = string(_libmpfr_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libmpfr_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libmpfr_path() = libmpfr_path - end # module MPFR_jll diff --git a/stdlib/Manifest.toml b/stdlib/Manifest.toml index 71c942549e804..2866272e90073 100644 --- a/stdlib/Manifest.toml +++ b/stdlib/Manifest.toml @@ -1,8 +1,8 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.12.0-DEV" +julia_version = "1.13.0-DEV" manifest_format = "2.0" -project_hash = "1cb1aede0b4f0a2f12806233b9f188a63d6acf04" +project_hash = "6826701002e0b87f8744b1c4bf97e2cff5fc1642" [[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" @@ -23,7 +23,7 @@ version = "1.11.0" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.2.0+0" +version = "1.3.0+1" [[deps.Dates]] deps = ["Printf"] @@ -44,7 +44,7 @@ version = "1.11.0" [[deps.Downloads]] deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" -version = "1.6.0" +version = "1.7.0" [[deps.FileWatching]] uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" @@ -56,7 +56,7 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" version = "1.11.0" [[deps.GMP_jll]] -deps = ["Artifacts", "Libdl"] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "781609d7-10c4-51f6-84f2-b8444358ff6d" version = "6.3.0+2" @@ -73,7 +73,7 @@ version = "1.12.0" [[deps.LLD_jll]] deps = ["Artifacts", "Libdl", "Zlib_jll", "libLLVM_jll"] uuid = "d55e3150-da41-5e91-b323-ecfd1eec6109" -version = "18.1.7+3" +version = "20.1.2+0" [[deps.LLVMLibUnwind_jll]] deps = ["Artifacts", "Libdl"] @@ -106,7 +106,7 @@ uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5" version = "1.9.0+0" [[deps.LibSSH2_jll]] -deps = ["Artifacts", "Libdl", "OpenSSL_jll"] +deps = ["Artifacts", "Libdl", "OpenSSL_jll", "Zlib_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" version = "1.11.3+1" @@ -116,7 +116,7 @@ uuid = "183b4373-6708-53ba-ad28-60e28bb38547" version = "2.0.1+20" [[deps.LibUnwind_jll]] -deps = ["Artifacts", "Libdl"] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl", "Zlib_jll"] uuid = "745a5e78-f969-53e9-954f-d19f2f74f4e3" version = "1.8.1+2" @@ -127,7 +127,7 @@ version = "1.11.0" [[deps.LinearAlgebra]] deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" -version = "1.11.0" +version = "1.12.0" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" @@ -149,7 +149,7 @@ version = "1.11.0" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2024.11.26" +version = "2025.2.25" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -158,7 +158,7 @@ version = "1.3.0" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.28+3" +version = "0.3.29+0" [[deps.OpenLibm_jll]] deps = ["Artifacts", "Libdl"] @@ -178,7 +178,7 @@ version = "10.44.0+1" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.12.0" +version = "1.13.0" weakdeps = ["REPL"] [deps.Pkg.extensions] @@ -195,7 +195,7 @@ uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" version = "1.11.0" [[deps.REPL]] -deps = ["InteractiveUtils", "JuliaSyntaxHighlighting", "Markdown", "Sockets", "StyledStrings", "Unicode"] +deps = ["FileWatching", "InteractiveUtils", "JuliaSyntaxHighlighting", "Markdown", "Sockets", "StyledStrings", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" version = "1.11.0" @@ -241,7 +241,7 @@ uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b" version = "1.11.0" [[deps.SuiteSparse_jll]] -deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" version = "7.10.1+0" @@ -285,7 +285,7 @@ uuid = "05ff407c-b0c1-5878-9df8-858cc2e60c36" version = "2.2.5+2" [[deps.libLLVM_jll]] -deps = ["Artifacts", "Libdl", "Zlib_jll", "Zstd_jll"] +deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl", "Zlib_jll", "Zstd_jll"] uuid = "8f36deef-c2a5-5394-99ed-8e07531fb29a" version = "20.1.2+1" diff --git a/stdlib/OpenBLAS_jll/Project.toml b/stdlib/OpenBLAS_jll/Project.toml index 07a81d3c1d547..8eafa2f2365c1 100644 --- a/stdlib/OpenBLAS_jll/Project.toml +++ b/stdlib/OpenBLAS_jll/Project.toml @@ -3,10 +3,9 @@ uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" version = "0.3.29+0" [deps] -# See note in `src/OpenBLAS_jll.jl` about this dependency. +Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" CompilerSupportLibraries_jll = "e66e0078-7015-5450-92f7-15fbd957f2ae" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" -Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" [compat] julia = "1.11" diff --git a/stdlib/OpenBLAS_jll/src/OpenBLAS_jll.jl b/stdlib/OpenBLAS_jll/src/OpenBLAS_jll.jl index bd93b050ebbee..e3f4f14391369 100644 --- a/stdlib/OpenBLAS_jll/src/OpenBLAS_jll.jl +++ b/stdlib/OpenBLAS_jll/src/OpenBLAS_jll.jl @@ -2,7 +2,7 @@ ## dummy stub for https://github.com/JuliaBinaryWrappers/OpenBLAS_jll.jl baremodule OpenBLAS_jll -using Base, Libdl, Base.BinaryPlatforms +using Base, Libdl using CompilerSupportLibraries_jll export libopenblas @@ -28,7 +28,17 @@ elseif Sys.isapple() else const _libopenblas_path = BundledLazyLibraryPath(string("libopenblas", libsuffix, ".so")) end -const libopenblas = LazyLibrary(_libopenblas_path, dependencies=[libgfortran]) + +_libopenblas_dependencies = LazyLibrary[libgfortran] +if Sys.isapple() + if isdefined(CompilerSupportLibraries_jll, :libquadmath) + push!(_libopenblas_dependencies, CompilerSupportLibraries_jll.libquadmath) + end + if Sys.ARCH != :aarch64 + push!(_libopenblas_dependencies, CompilerSupportLibraries_jll.libgcc_s) + end +end +const libopenblas = LazyLibrary(_libopenblas_path, dependencies=_libopenblas_dependencies) # Conform to LazyJLLWrappers API function eager_mode() diff --git a/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl b/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl index 297cd25512894..54c7e6d64b7d4 100644 --- a/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl +++ b/stdlib/OpenLibm_jll/src/OpenLibm_jll.jl @@ -4,41 +4,36 @@ baremodule OpenLibm_jll using Base, Libdl -const PATH_list = String[] -const LIBPATH_list = String[] - export libopenlibm # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libopenlibm_handle::Ptr{Cvoid} = C_NULL libopenlibm_path::String = "" if Sys.iswindows() - const libopenlibm = "libopenlibm.dll" + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.dll") elseif Sys.isapple() - const libopenlibm = "@rpath/libopenlibm.4.dylib" + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.4.dylib") else - const libopenlibm = "libopenlibm.so.4" + const _libopenlibm_path = BundledLazyLibraryPath("libopenlibm.so.4") end +const libopenlibm = LazyLibrary(_libopenlibm_path) + +function eager_mode() + dlopen(libopenlibm) +end +is_available() = true + function __init__() - global libopenlibm_handle = dlopen(libopenlibm) - global libopenlibm_path = dlpath(libopenlibm_handle) + global libopenlibm_path = string(_libopenlibm_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libopenlibm_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libopenlibm_path() = libopenlibm_path - end # module OpenLibm_jll diff --git a/stdlib/OpenSSL_jll/src/OpenSSL_jll.jl b/stdlib/OpenSSL_jll/src/OpenSSL_jll.jl index bba9a0a299de9..b9169b5f9c5cf 100644 --- a/stdlib/OpenSSL_jll/src/OpenSSL_jll.jl +++ b/stdlib/OpenSSL_jll/src/OpenSSL_jll.jl @@ -5,54 +5,55 @@ baremodule OpenSSL_jll using Base, Libdl, Base.BinaryPlatforms -const PATH_list = String[] -const LIBPATH_list = String[] - export libcrypto, libssl # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libcrypto_handle::Ptr{Cvoid} = C_NULL libcrypto_path::String = "" -libssl_handle::Ptr{Cvoid} = C_NULL libssl_path::String = "" if Sys.iswindows() if arch(HostPlatform()) == "x86_64" - const libcrypto = "libcrypto-3-x64.dll" - const libssl = "libssl-3-x64.dll" + const _libcrypto_path = BundledLazyLibraryPath("libcrypto-3-x64.dll") + const _libssl_path = BundledLazyLibraryPath("libssl-3-x64.dll") else - const libcrypto = "libcrypto-3.dll" - const libssl = "libssl-3.dll" + const _libcrypto_path = BundledLazyLibraryPath("libcrypto-3.dll") + const _libssl_path = BundledLazyLibraryPath("libssl-3.dll") end elseif Sys.isapple() - const libcrypto = "@rpath/libcrypto.3.dylib" - const libssl = "@rpath/libssl.3.dylib" + const _libcrypto_path = BundledLazyLibraryPath("libcrypto.3.dylib") + const _libssl_path = BundledLazyLibraryPath("libssl.3.dylib") else - const libcrypto = "libcrypto.so.3" - const libssl = "libssl.so.3" + const _libcrypto_path = BundledLazyLibraryPath("libcrypto.so.3") + const _libssl_path = BundledLazyLibraryPath("libssl.so.3") +end + +const libcrypto = LazyLibrary(_libcrypto_path) + +_libssl_dependencies = LazyLibrary[libcrypto] +const libssl = LazyLibrary(_libssl_path, dependencies=_libssl_dependencies) + +function eager_mode() + dlopen(libcrypto) + dlopen(libssl) end +is_available() = true function __init__() - global libcrypto_handle = dlopen(libcrypto) - global libcrypto_path = dlpath(libcrypto_handle) - global libssl_handle = dlopen(libssl) - global libssl_path = dlpath(libssl_handle) + global libcrypto_path = string(_libcrypto_path) + global libssl_path = string(_libssl_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libssl_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libcrypto_path() = libcrypto_path -get_libssl_path() = libssl_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module OpenSSL_jll diff --git a/stdlib/PCRE2_jll/src/PCRE2_jll.jl b/stdlib/PCRE2_jll/src/PCRE2_jll.jl index d825ac74db5a8..9af7fb3863a23 100644 --- a/stdlib/PCRE2_jll/src/PCRE2_jll.jl +++ b/stdlib/PCRE2_jll/src/PCRE2_jll.jl @@ -4,41 +4,41 @@ baremodule PCRE2_jll using Base, Libdl -const PATH_list = String[] -const LIBPATH_list = String[] - export libpcre2_8 # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libpcre2_8_handle::Ptr{Cvoid} = C_NULL libpcre2_8_path::String = "" if Sys.iswindows() - const libpcre2_8 = "libpcre2-8-0.dll" + const _libpcre2_8_path = BundledLazyLibraryPath("libpcre2-8-0.dll") elseif Sys.isapple() - const libpcre2_8 = "@rpath/libpcre2-8.0.dylib" + const _libpcre2_8_path = BundledLazyLibraryPath("libpcre2-8.0.dylib") else - const libpcre2_8 = "libpcre2-8.so.0" + const _libpcre2_8_path = BundledLazyLibraryPath("libpcre2-8.so.0") end +const libpcre2_8 = LazyLibrary(_libpcre2_8_path) + +function eager_mode() + dlopen(libpcre2_8) +end +is_available() = true + function __init__() - global libpcre2_8_handle = dlopen(libpcre2_8) - global libpcre2_8_path = dlpath(libpcre2_8_handle) + global libpcre2_8_path = string(_libpcre2_8_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libpcre2_8_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libpcre2_8_path() = libpcre2_8_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module PCRE2_jll diff --git a/stdlib/Project.toml b/stdlib/Project.toml index 1e03a0f474490..2051377a6967c 100644 --- a/stdlib/Project.toml +++ b/stdlib/Project.toml @@ -54,6 +54,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a" +Zstd_jll = "3161d3a3-bdf6-5164-811a-617609db77b4" dSFMT_jll = "05ff407c-b0c1-5878-9df8-858cc2e60c36" libLLVM_jll = "8f36deef-c2a5-5394-99ed-8e07531fb29a" libblastrampoline_jll = "8e850b90-86db-534c-a0d3-1478176c7d93" diff --git a/stdlib/SuiteSparse_jll/Project.toml b/stdlib/SuiteSparse_jll/Project.toml index cfe46b3fd9569..ff454476db148 100644 --- a/stdlib/SuiteSparse_jll/Project.toml +++ b/stdlib/SuiteSparse_jll/Project.toml @@ -3,11 +3,13 @@ uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" version = "7.10.1+0" [deps] -libblastrampoline_jll = "8e850b90-86db-534c-a0d3-1478176c7d93" -Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +CompilerSupportLibraries_jll = "e66e0078-7015-5450-92f7-15fbd957f2ae" +Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" +libblastrampoline_jll = "8e850b90-86db-534c-a0d3-1478176c7d93" [compat] +CompilerSupportLibraries_jll = "1.3.0" julia = "1.13" [extras] diff --git a/stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl b/stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl index b0699f132eb7f..f24b36ee0ddea 100644 --- a/stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl +++ b/stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl @@ -2,139 +2,157 @@ ## dummy stub for https://github.com/JuliaBinaryWrappers/SuiteSparse_jll.jl baremodule SuiteSparse_jll -using Base, Libdl, libblastrampoline_jll - -const PATH_list = String[] -const LIBPATH_list = String[] +using Base, Libdl, libblastrampoline_jll, CompilerSupportLibraries_jll export libamd, libbtf, libcamd, libccolamd, libcholmod, libcolamd, libklu, libldl, librbio, libspqr, libsuitesparseconfig, libumfpack # These get calculated in __init__() # Man I can't wait until these are automatically handled by an in-Base JLLWrappers clone. const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libamd_handle::Ptr{Cvoid} = C_NULL libamd_path::String = "" -libbtf_handle::Ptr{Cvoid} = C_NULL libbtf_path::String = "" -libcamd_handle::Ptr{Cvoid} = C_NULL libcamd_path::String = "" -libccolamd_handle::Ptr{Cvoid} = C_NULL libccolamd_path::String = "" -libcholmod_handle::Ptr{Cvoid} = C_NULL libcholmod_path::String = "" -libcolamd_handle::Ptr{Cvoid} = C_NULL libcolamd_path::String = "" -libklu_handle::Ptr{Cvoid} = C_NULL libklu_path::String = "" -libldl_handle::Ptr{Cvoid} = C_NULL libldl_path::String = "" -librbio_handle::Ptr{Cvoid} = C_NULL librbio_path::String = "" -libspqr_handle::Ptr{Cvoid} = C_NULL libspqr_path::String = "" -libsuitesparseconfig_handle::Ptr{Cvoid} = C_NULL libsuitesparseconfig_path::String = "" -libumfpack_handle::Ptr{Cvoid} = C_NULL libumfpack_path::String = "" if Sys.iswindows() - const libamd = "libamd.dll" - const libbtf = "libbtf.dll" - const libcamd = "libcamd.dll" - const libccolamd = "libccolamd.dll" - const libcholmod = "libcholmod.dll" - const libcolamd = "libcolamd.dll" - const libklu = "libklu.dll" - const libldl = "libldl.dll" - const librbio = "librbio.dll" - const libspqr = "libspqr.dll" - const libsuitesparseconfig = "libsuitesparseconfig.dll" - const libumfpack = "libumfpack.dll" + const _libamd_path = BundledLazyLibraryPath("libamd.dll") + const _libbtf_path = BundledLazyLibraryPath("libbtf.dll") + const _libcamd_path = BundledLazyLibraryPath("libcamd.dll") + const _libccolamd_path = BundledLazyLibraryPath("libccolamd.dll") + const _libcholmod_path = BundledLazyLibraryPath("libcholmod.dll") + const _libcolamd_path = BundledLazyLibraryPath("libcolamd.dll") + const _libklu_path = BundledLazyLibraryPath("libklu.dll") + const _libldl_path = BundledLazyLibraryPath("libldl.dll") + const _librbio_path = BundledLazyLibraryPath("librbio.dll") + const _libspqr_path = BundledLazyLibraryPath("libspqr.dll") + const _libsuitesparseconfig_path = BundledLazyLibraryPath("libsuitesparseconfig.dll") + const _libumfpack_path = BundledLazyLibraryPath("libumfpack.dll") elseif Sys.isapple() - const libamd = "@rpath/libamd.3.dylib" - const libbtf = "@rpath/libbtf.2.dylib" - const libcamd = "@rpath/libcamd.3.dylib" - const libccolamd = "@rpath/libccolamd.3.dylib" - const libcholmod = "@rpath/libcholmod.5.dylib" - const libcolamd = "@rpath/libcolamd.3.dylib" - const libklu = "@rpath/libklu.2.dylib" - const libldl = "@rpath/libldl.3.dylib" - const librbio = "@rpath/librbio.4.dylib" - const libspqr = "@rpath/libspqr.4.dylib" - const libsuitesparseconfig = "@rpath/libsuitesparseconfig.7.dylib" - const libumfpack = "@rpath/libumfpack.6.dylib" + const _libamd_path = BundledLazyLibraryPath("libamd.3.dylib") + const _libbtf_path = BundledLazyLibraryPath("libbtf.2.dylib") + const _libcamd_path = BundledLazyLibraryPath("libcamd.3.dylib") + const _libccolamd_path = BundledLazyLibraryPath("libccolamd.3.dylib") + const _libcholmod_path = BundledLazyLibraryPath("libcholmod.5.dylib") + const _libcolamd_path = BundledLazyLibraryPath("libcolamd.3.dylib") + const _libklu_path = BundledLazyLibraryPath("libklu.2.dylib") + const _libldl_path = BundledLazyLibraryPath("libldl.3.dylib") + const _librbio_path = BundledLazyLibraryPath("librbio.4.dylib") + const _libspqr_path = BundledLazyLibraryPath("libspqr.4.dylib") + const _libsuitesparseconfig_path = BundledLazyLibraryPath("libsuitesparseconfig.7.dylib") + const _libumfpack_path = BundledLazyLibraryPath("libumfpack.6.dylib") else - const libamd = "libamd.so.3" - const libbtf = "libbtf.so.2" - const libcamd = "libcamd.so.3" - const libccolamd = "libccolamd.so.3" - const libcholmod = "libcholmod.so.5" - const libcolamd = "libcolamd.so.3" - const libklu = "libklu.so.2" - const libldl = "libldl.so.3" - const librbio = "librbio.so.4" - const libspqr = "libspqr.so.4" - const libsuitesparseconfig = "libsuitesparseconfig.so.7" - const libumfpack = "libumfpack.so.6" + const _libamd_path = BundledLazyLibraryPath("libamd.so.3") + const _libbtf_path = BundledLazyLibraryPath("libbtf.so.2") + const _libcamd_path = BundledLazyLibraryPath("libcamd.so.3") + const _libccolamd_path = BundledLazyLibraryPath("libccolamd.so.3") + const _libcholmod_path = BundledLazyLibraryPath("libcholmod.so.5") + const _libcolamd_path = BundledLazyLibraryPath("libcolamd.so.3") + const _libklu_path = BundledLazyLibraryPath("libklu.so.2") + const _libldl_path = BundledLazyLibraryPath("libldl.so.3") + const _librbio_path = BundledLazyLibraryPath("librbio.so.4") + const _libspqr_path = BundledLazyLibraryPath("libspqr.so.4") + const _libsuitesparseconfig_path = BundledLazyLibraryPath("libsuitesparseconfig.so.7") + const _libumfpack_path = BundledLazyLibraryPath("libumfpack.so.6") end -function __init__() +const libsuitesparseconfig = LazyLibrary(_libsuitesparseconfig_path) +const libldl = LazyLibrary(_libldl_path) +const libbtf = LazyLibrary(_libbtf_path) + +_libcolamd_dependencies = LazyLibrary[libsuitesparseconfig] +const libcolamd = LazyLibrary(_libcolamd_path; dependencies=_libcolamd_dependencies) + +_libamd_dependencies = LazyLibrary[libsuitesparseconfig] +const libamd = LazyLibrary(_libamd_path; dependencies=_libamd_dependencies) + +_libcamd_dependencies = LazyLibrary[libsuitesparseconfig] +const libcamd = LazyLibrary(_libcamd_path; dependencies=_libcamd_dependencies) + +_libccolamd_dependencies = LazyLibrary[libsuitesparseconfig] +const libccolamd = LazyLibrary(_libccolamd_path; dependencies=_libccolamd_dependencies) + +_librbio_dependencies = LazyLibrary[libsuitesparseconfig] +const librbio = LazyLibrary(_librbio_path; dependencies=_librbio_dependencies) + +_libcholmod_dependencies = LazyLibrary[ + libsuitesparseconfig, libamd, libcamd, libccolamd, libcolamd, libblastrampoline + ] +const libcholmod = LazyLibrary(_libcholmod_path; dependencies=_libcholmod_dependencies) + +_libklu_dependencies = LazyLibrary[libsuitesparseconfig, libamd, libcolamd, libbtf] +const libklu = LazyLibrary(_libklu_path; dependencies=_libklu_dependencies) + +if Sys.isfreebsd() + _libspqr_dependencies = LazyLibrary[libcholmod, libblastrampoline, libsuitesparseconfig] +elseif Sys.isapple() + _libspqr_dependencies = LazyLibrary[libsuitesparseconfig, libcholmod, libblastrampoline] +else + _libspqr_dependencies = LazyLibrary[ + libstdcxx, libgcc_s, libsuitesparseconfig, libcholmod, libblastrampoline + ] +end +const libspqr = LazyLibrary(_libspqr_path; dependencies=_libspqr_dependencies) + +_libumfpack_dependencies = LazyLibrary[libsuitesparseconfig, libamd, libcholmod, libblastrampoline] +const libumfpack = LazyLibrary(_libumfpack_path; dependencies=_libumfpack_dependencies) + +function eager_mode() + CompilerSupportLibraries_jll.eager_mode() libblastrampoline_jll.eager_mode() + dlopen(libamd) + dlopen(libbtf) + dlopen(libcamd) + dlopen(libccolamd) + dlopen(libcholmod) + dlopen(libcolamd) + dlopen(libklu) + dlopen(libldl) + dlopen(librbio) + dlopen(libspqr) + dlopen(libsuitesparseconfig) + dlopen(libumfpack) +end +is_available() = true + +function __init__() # BSD-3-Clause - global libamd_handle = dlopen(libamd) - global libamd_path = dlpath(libamd_handle) - global libcamd_handle = dlopen(libcamd) - global libcamd_path = dlpath(libcamd_handle) - global libccolamd_handle = dlopen(libccolamd) - global libccolamd_path = dlpath(libccolamd_handle) - global libcolamd_handle = dlopen(libcolamd) - global libcolamd_path = dlpath(libcolamd_handle) - global libsuitesparseconfig_handle = dlopen(libsuitesparseconfig) - global libsuitesparseconfig_path = dlpath(libsuitesparseconfig_handle) + global libamd_path = string(_libamd_path) + global libcamd_path = string(_libcamd_path) + global libccolamd_path = string(_libccolamd_path) + global libcolamd_path = string(_libcolamd_path) + global libsuitesparseconfig_path = string(_libsuitesparseconfig_path) # LGPL-2.1+ - global libbtf_handle = dlopen(libbtf) - global libbtf_path = dlpath(libbtf_handle) - global libklu_handle = dlopen(libklu) - global libklu_path = dlpath(libklu_handle) - global libldl_handle = dlopen(libldl) - global libldl_path = dlpath(libldl_handle) + global libbtf_path = string(_libbtf_path) + global libklu_path = string(_libklu_path) + global libldl_path = string(_libldl_path) # GPL-2.0+ if Base.USE_GPL_LIBS - global libcholmod_handle = dlopen(libcholmod) - global libcholmod_path = dlpath(libcholmod_handle) - global librbio_handle = dlopen(librbio) - global librbio_path = dlpath(librbio_handle) - global libspqr_handle = dlopen(libspqr) - global libspqr_path = dlpath(libspqr_handle) - global libumfpack_handle = dlopen(libumfpack) - global libumfpack_path = dlpath(libumfpack_handle) + global libcholmod_path = string(_libcholmod_path) + global librbio_path = string(_librbio_path) + global libspqr_path = string(_libspqr_path) + global libumfpack_path = string(_libumfpack_path) end global artifact_dir = dirname(Sys.BINDIR) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libamd_path() = libamd_path -get_libbtf_path() = libbtf_path -get_libcamd_path() = libcamd_path -get_libccolamd_path() = libccolamd_path -get_libcholmod_path() = libcholmod_path -get_libcolamd_path() = libcolamd_path -get_libklu_path() = libklu_path -get_libldl_path() = libldl_path -get_librbio_path() = librbio_path -get_libspqr_path() = libspqr_path -get_libsuitesparseconfig_path() = libsuitesparseconfig_path -get_libumfpack_path() = libumfpack_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module SuiteSparse_jll diff --git a/stdlib/Zlib_jll/src/Zlib_jll.jl b/stdlib/Zlib_jll/src/Zlib_jll.jl index fb043c7143789..649cb93f862da 100644 --- a/stdlib/Zlib_jll/src/Zlib_jll.jl +++ b/stdlib/Zlib_jll/src/Zlib_jll.jl @@ -4,41 +4,40 @@ baremodule Zlib_jll using Base, Libdl -const PATH_list = String[] -const LIBPATH_list = String[] - export libz # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libz_handle::Ptr{Cvoid} = C_NULL libz_path::String = "" if Sys.iswindows() - const libz = "libz.dll" + const _libz_path = BundledLazyLibraryPath("libz.dll") elseif Sys.isapple() - const libz = "@rpath/libz.1.dylib" + const _libz_path = BundledLazyLibraryPath("libz.1.dylib") else - const libz = "libz.so.1" + const _libz_path = BundledLazyLibraryPath("libz.so.1") end +const libz = LazyLibrary(_libz_path) + +function eager_mode() + dlopen(libz) +end +is_available() = true function __init__() - global libz_handle = dlopen(libz) - global libz_path = dlpath(libz_handle) + global libz_path = string(_libz_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libz_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libz_path() = libz_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module Zlib_jll diff --git a/stdlib/Zstd_jll/src/Zstd_jll.jl b/stdlib/Zstd_jll/src/Zstd_jll.jl index c16413f963d0b..004a884bed1ff 100644 --- a/stdlib/Zstd_jll/src/Zstd_jll.jl +++ b/stdlib/Zstd_jll/src/Zstd_jll.jl @@ -8,16 +8,23 @@ using Base, Libdl export libzstd, zstd, zstdmt # These get calculated in __init__() -libzstd_handle::Ptr{Cvoid} = C_NULL +const PATH = Ref("") +const PATH_list = String[] +const LIBPATH = Ref("") +const LIBPATH_list = String[] +artifact_dir::String = "" +libzstd_path::String = "" if Sys.iswindows() - const libzstd = "libzstd-1.dll" + const _libzstd_path = BundledLazyLibraryPath("libzstd-1.dll") elseif Sys.isapple() - const libzstd = "@rpath/libzstd.1.dylib" + const _libzstd_path = BundledLazyLibraryPath("libzstd.1.dylib") else - const libzstd = "libzstd.so.1" + const _libzstd_path = BundledLazyLibraryPath("libzstd.so.1") end +const libzstd = LazyLibrary(_libzstd_path) + if Sys.iswindows() const zstd_exe = "zstd.exe" const zstdmt_exe = "zstdmt.exe" @@ -65,9 +72,21 @@ end zstd() = adjust_ENV(`$(joinpath(Sys.BINDIR, Base.PRIVATE_LIBEXECDIR, zstd_exe))`) zstdmt() = adjust_ENV(`$(joinpath(Sys.BINDIR, Base.PRIVATE_LIBEXECDIR, zstdmt_exe))`) +# Function to eagerly dlopen our library and thus resolve all dependencies +function eager_mode() + dlopen(libzstd) +end + +is_available() = true + function __init__() - global libzstd_handle = dlopen(libzstd) - nothing + global libzstd_path = string(_libzstd_path) + global artifact_dir = dirname(Sys.BINDIR) +end + +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) end end # module Zstd_jll diff --git a/stdlib/dSFMT_jll/src/dSFMT_jll.jl b/stdlib/dSFMT_jll/src/dSFMT_jll.jl index b84bf0d8204ae..b7e79c9d587ea 100644 --- a/stdlib/dSFMT_jll/src/dSFMT_jll.jl +++ b/stdlib/dSFMT_jll/src/dSFMT_jll.jl @@ -5,41 +5,41 @@ baremodule dSFMT_jll using Base, Libdl -const PATH_list = String[] -const LIBPATH_list = String[] - export libdSFMT # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libdSFMT_handle::Ptr{Cvoid} = C_NULL libdSFMT_path::String = "" if Sys.iswindows() - const libdSFMT = "libdSFMT.dll" + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dll") elseif Sys.isapple() - const libdSFMT = "@rpath/libdSFMT.dylib" + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.dylib") else - const libdSFMT = "libdSFMT.so" + const _libdSFMT_path = BundledLazyLibraryPath("libdSFMT.so") end +const libdSFMT = LazyLibrary(_libdSFMT_path) + +function eager_mode() + dlopen(libdSFMT) +end +is_available() = true + function __init__() - global libdSFMT_handle = dlopen(libdSFMT) - global libdSFMT_path = dlpath(libdSFMT_handle) + global libdSFMT_path = string(_libdSFMT_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libdSFMT_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libdSFMT_path() = libdSFMT_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module dSFMT_jll diff --git a/stdlib/libLLVM_jll/Project.toml b/stdlib/libLLVM_jll/Project.toml index 04280f23f58da..364e4338840eb 100644 --- a/stdlib/libLLVM_jll/Project.toml +++ b/stdlib/libLLVM_jll/Project.toml @@ -4,13 +4,15 @@ version = "20.1.2+1" [deps] Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +CompilerSupportLibraries_jll = "e66e0078-7015-5450-92f7-15fbd957f2ae" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" Zlib_jll = "83775a58-1f1d-513f-b197-d71354ab007a" Zstd_jll = "3161d3a3-bdf6-5164-811a-617609db77b4" [compat] +CompilerSupportLibraries_jll = "1.3.0" Zlib_jll = "1" -Zstd_jll = "1.5" +Zstd_jll = "1.5.7" julia = "1.13" [extras] diff --git a/stdlib/libLLVM_jll/src/libLLVM_jll.jl b/stdlib/libLLVM_jll/src/libLLVM_jll.jl index c7d4a9128f312..597429d3619c9 100644 --- a/stdlib/libLLVM_jll/src/libLLVM_jll.jl +++ b/stdlib/libLLVM_jll/src/libLLVM_jll.jl @@ -3,43 +3,57 @@ ## dummy stub for https://github.com/JuliaBinaryWrappers/libLLVM_jll.jl baremodule libLLVM_jll -using Base, Libdl, Zlib_jll, Zstd_jll - -const PATH_list = String[] -const LIBPATH_list = String[] +using Base, Libdl, Zlib_jll, Zstd_jll, CompilerSupportLibraries_jll export libLLVM # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libLLVM_handle::Ptr{Cvoid} = C_NULL libLLVM_path::String = "" if Sys.iswindows() - const libLLVM = "$(Base.libllvm_name).dll" + const _libLLVM_path = BundledLazyLibraryPath("$(Base.libllvm_name).dll") elseif Sys.isapple() - const libLLVM = "@rpath/libLLVM.dylib" + const _libLLVM_path = BundledLazyLibraryPath("libLLVM.dylib") else - const libLLVM = "$(Base.libllvm_name).so" + const _libLLVM_path = BundledLazyLibraryPath("$(Base.libllvm_name).so") end +if Sys.isfreebsd() + _libLLVM_dependencies = LazyLibrary[libz, libzstd, libgcc_s] +elseif Sys.isapple() + _libLLVM_dependencies = LazyLibrary[libz, libzstd] +else + _libLLVM_dependencies = LazyLibrary[libstdcxx, libgcc_s, libz, libzstd] +end + +const libLLVM = LazyLibrary( + _libLLVM_path, + dependencies=_libLLVM_dependencies, +) + +function eager_mode() + CompilerSupportLibraries_jll.eager_mode() + Zlib_jll.eager_mode() + # Zstd_jll.eager_mode() # Not lazy yet + dlopen(libLLVM) +end +is_available() = true + function __init__() - global libLLVM_handle = dlopen(libLLVM) - global libLLVM_path = dlpath(libLLVM_handle) + global libLLVM_path = string(_libLLVM_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libLLVM_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libLLVM_path() = libLLVM_path +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end end # module libLLVM_jll diff --git a/stdlib/libLLVM_jll/test/runtests.jl b/stdlib/libLLVM_jll/test/runtests.jl index e04076f4145a5..8025c2cb2e693 100644 --- a/stdlib/libLLVM_jll/test/runtests.jl +++ b/stdlib/libLLVM_jll/test/runtests.jl @@ -4,5 +4,5 @@ using Test, Libdl, libLLVM_jll @testset "libLLVM_jll" begin # Try to find a symbol from the C API of libLLVM as a simple sanity check. - @test dlsym(libLLVM_jll.libLLVM_handle, :LLVMContextCreate; throw_error=false) !== nothing + @test dlsym(libLLVM_jll.libLLVM, :LLVMContextCreate; throw_error=false) !== nothing end diff --git a/stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl b/stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl index 6cdc1b4ac3ce6..01d222b8a472d 100644 --- a/stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl +++ b/stdlib/libblastrampoline_jll/src/libblastrampoline_jll.jl @@ -58,4 +58,10 @@ function __init__() LIBPATH[] = dirname(libblastrampoline_path) push!(LIBPATH_list, LIBPATH[]) end + +if Base.generating_output() + precompile(eager_mode, ()) + precompile(is_available, ()) +end + end # module libblastrampoline_jll diff --git a/stdlib/nghttp2_jll/src/nghttp2_jll.jl b/stdlib/nghttp2_jll/src/nghttp2_jll.jl index 5057299614aa5..3257c9602822b 100644 --- a/stdlib/nghttp2_jll/src/nghttp2_jll.jl +++ b/stdlib/nghttp2_jll/src/nghttp2_jll.jl @@ -4,41 +4,36 @@ baremodule nghttp2_jll using Base, Libdl -const PATH_list = String[] -const LIBPATH_list = String[] - export libnghttp2 # These get calculated in __init__() const PATH = Ref("") +const PATH_list = String[] const LIBPATH = Ref("") +const LIBPATH_list = String[] artifact_dir::String = "" -libnghttp2_handle::Ptr{Cvoid} = C_NULL libnghttp2_path::String = "" if Sys.iswindows() - const libnghttp2 = "libnghttp2-14.dll" + const _libnghttp2_path = BundledLazyLibraryPath("libnghttp2-14.dll") elseif Sys.isapple() - const libnghttp2 = "@rpath/libnghttp2.14.dylib" + const _libnghttp2_path = BundledLazyLibraryPath("libnghttp2.14.dylib") else - const libnghttp2 = "libnghttp2.so.14" + const _libnghttp2_path = BundledLazyLibraryPath("libnghttp2.so.14") end +const libnghttp2 = LazyLibrary(_libnghttp2_path) + +function eager_mode() + dlopen(libnghttp2) +end +is_available() = true + function __init__() - global libnghttp2_handle = dlopen(libnghttp2) - global libnghttp2_path = dlpath(libnghttp2_handle) + global libnghttp2_path = string(_libnghttp2_path) global artifact_dir = dirname(Sys.BINDIR) LIBPATH[] = dirname(libnghttp2_path) push!(LIBPATH_list, LIBPATH[]) end -# JLLWrappers API compatibility shims. Note that not all of these will really make sense. -# For instance, `find_artifact_dir()` won't actually be the artifact directory, because -# there isn't one. It instead returns the overall Julia prefix. -is_available() = true -find_artifact_dir() = artifact_dir -dev_jll() = error("stdlib JLLs cannot be dev'ed") -best_wrapper = nothing -get_libnghttp2_path() = libnghttp2_path - end # module nghttp2_jll diff --git a/test/choosetests.jl b/test/choosetests.jl index b07f5e8310ee6..c68fee2e09f32 100644 --- a/test/choosetests.jl +++ b/test/choosetests.jl @@ -22,7 +22,7 @@ const TESTNAMES = [ "euler", "show", "client", "terminfo", "errorshow", "sets", "goto", "llvmcall", "llvmcall2", "ryu", "some", "meta", "stacktraces", "docs", "gc", - "misc", "threads", "stress", "binaryplatforms", "atexit", + "misc", "threads", "stress", "binaryplatforms","stdlib_dependencies", "atexit", "enums", "cmdlineargs", "int", "interpreter", "checked", "bitset", "floatfuncs", "precompile", "relocatedepot", "boundscheck", "error", "ambiguous", "cartesian", "osutils", diff --git a/test/stdlib_dependencies.jl b/test/stdlib_dependencies.jl new file mode 100644 index 0000000000000..0bcec13a02de8 --- /dev/null +++ b/test/stdlib_dependencies.jl @@ -0,0 +1,197 @@ +using Pkg, Test, Libdl + +# Remove `.X.dylib` or just `.dylib` +function strip_soversion_macos(lib) + m = match(r"^(.*?)(\.\d+)*\.dylib$", lib) + if m !== nothing + return m.captures[1] + end + return lib +end + +# Remove `.so.X` or just `.so` +function strip_soversion_linux(lib) + m = match(r"^(.*?)\.so(\.\d+)*$", lib) + if m !== nothing + return m.captures[1] + end + return lib +end + +# Remove `-X.dll` or just `.dll` +function strip_soversion_windows(lib) + m = match(r"^(.*?)(-\d+)*\.dll$", lib) + if m !== nothing + return m.captures[1] + end + return lib +end + + +function get_deps_otool(lib_path::String) + libs = split(readchomp(`otool -L $(lib_path)`), "\n")[2:end] + # Get rid of `(compatibility version x.y.x)` at the end + libs = first.(split.(libs, (" (compatibility",))) + # Get rid of any `@rpath/` stuff at the beginning + libs = last.(split.(libs, ("@rpath/",))) + + # If there are any absolute paths left, get rid of them here + libs = basename.(strip.(libs)) + + # Now that we've got the basenames of each library, remove `.x.dylib` if it exists: + libs = strip_soversion_macos.(libs) + + # Get rid of any self-referential links + self_lib = strip_soversion_macos(basename(lib_path)) + libs = filter(!=(self_lib), libs) + return libs +end + +function is_system_lib_macos(lib) + system_libs = [ + "libSystem.B", + "libc++", # While we package libstdc++, we do NOT package libc++. + "libiconv", # some things (like git) link against system libiconv + + # macOS frameworks used by things like LibCurl + "CoreFoundation", + "CoreServices", + "Security", + "SystemConfiguration" + ] + return lib ∈ system_libs +end + +function is_system_lib_linux(lib) + system_libs = [ + "libdl", + "libc", + "libm", + "librt", + "libpthread", + "ld-linux-x86-64", + "ld-linux-x86", + "ld-linux-aarch64", + "ld-linux-armhf", + "ld-linux-i386", + ] + return lib ∈ system_libs +end + +function is_system_lib_freebsd(lib) + system_libs = [ + "libc", + "libm", + "libthr", # primary threading library + "libpthread", # alias kept for compatibility + "librt", + "libutil", + "libexecinfo", + "libcxxrt", + ] + return lib ∈ system_libs +end + +function get_deps_readelf(lib_path::String) + # Split into lines + libs = split(readchomp(`readelf -d $(lib_path)`), "\n") + + # Only keep `(NEEDED)` lines + needed_str = Sys.isfreebsd() ? "NEEDED" : "(NEEDED)" + libs = filter(contains(needed_str), libs) + + # Grab the SONAME from "Shared library: [$SONAME]" + libs = map(libs) do lib + m = match(r"Shared library: \[(.*)\]$", lib) + if m !== nothing + return basename(m.captures[1]) + end + return "" + end + libs = filter(!isempty, strip.(libs)) + + # Get rid of soversions in the filenames + libs = strip_soversion_linux.(libs) + return libs +end + + +skip = false +# On linux, we need `readelf` available, otherwise we refuse to attempt this +if Sys.islinux() || Sys.isfreebsd() + if Sys.which("readelf") === nothing + @debug("Silently skipping stdlib_dependencies.jl as `readelf` not available.") + skip = true + end + get_deps = get_deps_readelf + strip_soversion = strip_soversion_linux + is_system_lib = Sys.islinux() ? is_system_lib_linux : is_system_lib_freebsd +elseif Sys.isapple() + # On macOS, we need `otool` available + if Sys.which("otool") === nothing + @debug("Silently skipping stdlib_dependencies.jl as `otool` not available.") + skip = true + end + get_deps = get_deps_otool + strip_soversion = strip_soversion_macos + is_system_lib = is_system_lib_macos +else + @debug("Don't know how to run `stdlib_dependencies.jl` on this platform") + skip = true +end + +if !skip + # Iterate over all JLL stdlibs, check their lazy libraries to ensure + # that they list all valid library dependencies, avoiding a situation + # where the JLL wrapper code has fallen out of sync with the binaries + # themselves. + @testset "Stdlib JLL dependency check" begin + for (_, (stdlib_name, _)) in Pkg.Types.stdlibs() + if !endswith(stdlib_name, "_jll") + continue + end + + # Import the stdlib, skip it if it's not available on this platform + m = eval(Meta.parse("import $(stdlib_name); $(stdlib_name)")) + if !Base.invokelatest(getproperty(m, :is_available)) + continue + end + + for prop_name in names(m) + prop = getproperty(m, prop_name) + if isa(prop, Libdl.LazyLibrary) + lib_path = dlpath(prop) + lazy_lib_deps = strip_soversion.(basename.(dlpath.(prop.dependencies))) + real_lib_deps = filter(!is_system_lib, get_deps(lib_path)) + + # See if there are missing dependencies in the lazy library deps + missing_deps = setdiff(real_lib_deps, lazy_lib_deps) + extraneous_deps = setdiff(lazy_lib_deps, real_lib_deps) + + # We expect there to be no missing or extraneous deps + deps_mismatch = !isempty(missing_deps) || !isempty(extraneous_deps) + + # This is a manually-managed special case + if stdlib_name == "libblastrampoline_jll" && + prop_name == :libblastrampoline && + extraneous_deps == ["libopenblas64_"] + deps_mismatch = false + end + + @test !deps_mismatch + + # Print out the deps mismatch if we find one + if deps_mismatch + @warn("Dependency mismatch", + jll=stdlib_name, + library=string(prop_name), + missing_deps=join(missing_deps, ", "), + extraneous_deps=join(extraneous_deps, ", "), + actual_deps=join(real_lib_deps, ", "), + ) + end + end + end + end + end +end diff --git a/test/trimming/basic_jll.jl b/test/trimming/basic_jll.jl index 334b5466343d0..6754fc4697fd2 100644 --- a/test/trimming/basic_jll.jl +++ b/test/trimming/basic_jll.jl @@ -3,7 +3,7 @@ using Zstd_jll function @main(args::Vector{String})::Cint println(Core.stdout, "Julia! Hello, world!") - fptr = dlsym(Zstd_jll.libzstd_handle, :ZSTD_versionString) + fptr = dlsym(Zstd_jll.libzstd, :ZSTD_versionString) println(Core.stdout, unsafe_string(ccall(fptr, Cstring, ()))) println(Core.stdout, unsafe_string(ccall((:ZSTD_versionString, libzstd), Cstring, ()))) return 0