@@ -8,7 +8,7 @@ using Base, Libdl, Base.BinaryPlatforms
88const PATH_list = String[]
99const LIBPATH_list = String[]
1010
11- export libgfortran, libstdcxx, libgomp
11+ export libgfortran, libstdcxx, libgomp, libatomic, libgcc_s
1212
1313# These get calculated in __init__()
1414const PATH = Ref (" " )
@@ -24,61 +24,84 @@ libgomp_handle::Ptr{Cvoid} = C_NULL
2424libgomp_path:: String = " "
2525
2626if Sys. iswindows ()
27+ const _libatomic_path = BundledLazyLibraryPath (" bin\\ libatomic-1.dll" )
28+ const _libquadmath_path = BundledLazyLibraryPath (" bin\\ libquadmath-0.dll" )
2729 if arch (HostPlatform ()) == " x86_64"
28- const libgcc_s = " libgcc_s_seh-1.dll"
30+ const _libgcc_s_path = BundledLazyLibraryPath ( " bin \\ libgcc_s_seh-1.dll" )
2931 else
30- const libgcc_s = " libgcc_s_sjlj-1.dll"
32+ const _libgcc_s_path = BundledLazyLibraryPath ( " bin \\ libgcc_s_sjlj-1.dll" )
3133 end
32- const libgfortran = string (" libgfortran-" , libgfortran_version (HostPlatform ()). major, " .dll" )
33- const libstdcxx = " libstdc++-6.dll"
34- const libgomp = " libgomp-1.dll"
35- const libssp = " libssp-0.dll"
34+ const _libgfortran_path = BundledLazyLibraryPath ( string (" bin \\ libgfortran-" , libgfortran_version (HostPlatform ()). major, " .dll" ) )
35+ const _libstdcxx_path = BundledLazyLibraryPath ( " bin \\ libstdc++-6.dll" )
36+ const _libgomp_path = BundledLazyLibraryPath ( " bin \\ libgomp-1.dll" )
37+ const _libssp_path = BundledLazyLibraryPath ( " bin \\ libssp-0.dll" )
3638elseif Sys. isapple ()
39+ const _libatomic_path = BundledLazyLibraryPath (" lib/libatomic.1.dylib" )
40+ const _libquadmath_path = BundledLazyLibraryPath (" lib/libquadmath.0.dylib" )
3741 if arch (HostPlatform ()) == " aarch64" || libgfortran_version (HostPlatform ()) == v " 5"
38- const libgcc_s = " @rpath /libgcc_s.1.1.dylib"
42+ const _libgcc_s_path = BundledLazyLibraryPath ( " lib /libgcc_s.1.1.dylib" )
3943 else
40- const libgcc_s = " @rpath /libgcc_s.1.dylib"
44+ const _libgcc_s_path = BundledLazyLibraryPath ( " lib /libgcc_s.1.dylib" )
4145 end
42- const libgfortran = string (" @rpath/ " , " libgfortran." , libgfortran_version (HostPlatform ()). major, " .dylib" )
43- const libstdcxx = " @rpath /libstdc++.6.dylib"
44- const libgomp = " @rpath /libgomp.1.dylib"
45- const libssp = " @rpath /libssp.0.dylib"
46+ const _libgfortran_path = BundledLazyLibraryPath ( string (" lib/ libgfortran." , libgfortran_version (HostPlatform ()). major, " .dylib" ) )
47+ const _libstdcxx_path = BundledLazyLibraryPath ( " lib /libstdc++.6.dylib" )
48+ const _libgomp_path = BundledLazyLibraryPath ( " lib /libgomp.1.dylib" )
49+ const _libssp_path = BundledLazyLibraryPath ( " lib /libssp.0.dylib" )
4650else
47- const libgcc_s = " libgcc_s.so.1"
48- const libgfortran = string (" libgfortran.so." , libgfortran_version (HostPlatform ()). major)
49- const libstdcxx = " libstdc++.so.6"
50- const libgomp = " libgomp.so.1"
51+ const _libatomic_path = BundledLazyLibraryPath (" lib/libatomic.so.1" )
52+ const _libgcc_s_path = BundledLazyLibraryPath (" lib/libgcc_s.so.1" )
53+ const _libgfortran_path = BundledLazyLibraryPath (string (" lib/libgfortran.so." , libgfortran_version (HostPlatform ()). major))
54+ const _libstdcxx_path = BundledLazyLibraryPath (" lib/libstdc++.so.6" )
55+ const _libgomp_path = BundledLazyLibraryPath (" lib/libgomp.so.1" )
5156 if libc (HostPlatform ()) != " musl"
52- const libssp = " libssp.so.0"
57+ const _libssp_path = BundledLazyLibraryPath (" lib/libssp.so.0" )
58+ end
59+ if arch (HostPlatform ()) ∈ (" x86_64" , " i686" )
60+ const _libquadmath_path = BundledLazyLibraryPath (" lib/libquadmath.so.0" )
5361 end
5462end
5563
56- function __init__ ()
57- global libgcc_s_handle = dlopen (libgcc_s)
58- global libgcc_s_path = dlpath (libgcc_s_handle)
59- global libgfortran_handle = dlopen (libgfortran)
60- global libgfortran_path = dlpath (libgfortran_handle)
61- global libstdcxx_handle = dlopen (libstdcxx)
62- global libstdcxx_path = dlpath (libstdcxx_handle)
63- global libgomp_handle = dlopen (libgomp)
64- global libgomp_path = dlpath (libgomp_handle)
65- @static if libc (HostPlatform ()) != " musl"
66- dlopen (libssp; throw_error = false )
64+ const libatomic = LazyLibrary (_libatomic_path)
65+ const libgcc_s = LazyLibrary (_libgcc_s_path)
66+ libgfortran_deps = [libgcc_s]
67+ if @isdefined _libquadmath_path
68+ const libquadmath = LazyLibrary (_libquadmath_path)
69+ push! (libgfortran_deps, libquadmath)
70+ end
71+ const libgfortran = LazyLibrary (_libgfortran_path, dependencies= libgfortran_deps)
72+ const libstdcxx = LazyLibrary (_libstdcxx_path, dependencies= [libgcc_s])
73+ const libgomp = LazyLibrary (_libgomp_path)
74+ if @isdefined _libssp_path
75+ const libssp = LazyLibrary (_libssp_path)
76+ end
77+
78+ # Conform to LazyJLLWrappers API
79+ function eager_mode ()
80+ dlopen (libatomic)
81+ dlopen (libgcc_s)
82+ dlopen (libgomp)
83+ if @isdefined libquadmath
84+ dlopen (libquadmath)
85+ end
86+ if @isdefined libssp
87+ dlopen (libssp)
6788 end
89+ dlopen (libgfortran)
90+ dlopen (libstdcxx)
91+ end
92+ is_available () = true
93+
94+ function __init__ ()
95+ global libatomic_path = string (_libatomic_path)
96+ global libgcc_s_path = string (_libgcc_s_path)
97+ global libgomp_path = string (_libgomp_path)
98+ global libquadmath_path = string (_libquadmath_path)
99+ global libssp_path = string (_libssp_path)
100+ global libgfortran_path = string (_libgfortran_path)
101+ global libstdcxx_path = string (_libstdcxx_path)
68102 global artifact_dir = dirname (Sys. BINDIR)
69103 LIBPATH[] = dirname (libgcc_s_path)
70104 push! (LIBPATH_list, LIBPATH[])
71105end
72106
73- # JLLWrappers API compatibility shims. Note that not all of these will really make sense.
74- # For instance, `find_artifact_dir()` won't actually be the artifact directory, because
75- # there isn't one. It instead returns the overall Julia prefix.
76- is_available () = true
77- find_artifact_dir () = artifact_dir
78- dev_jll () = error (" stdlib JLLs cannot be dev'ed" )
79- best_wrapper = nothing
80- get_libgfortran_path () = libgfortran_path
81- get_libstdcxx_path () = libstdcxx_path
82- get_libgomp_path () = libgomp_path
83-
84107end # module CompilerSupportLibraries_jll
0 commit comments