Skip to content

Commit 7161e1a

Browse files
committed
Check for versions ≥ 15, handle pkgutil error
1 parent 1d955aa commit 7161e1a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/PackageCompiler.jl

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,15 @@ function create_sysimg_from_object_file(object_files::Vector{String},
687687
mkpath(dirname(sysimage_path))
688688
# Prevent compiler from stripping all symbols from the shared lib.
689689
if Sys.isapple()
690-
cltools_version_cmd = `pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`
691-
cltools_version = match(r"version: (.*)\n", readchomp(cltools_version_cmd))[1]
692-
if startswith(cltools_version, "15")
690+
try
691+
cltools_version_cmd = `pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`
692+
cltools_version = match(r"version: (.*)\n", readchomp(cltools_version_cmd))[1]
693+
global major_version = split(cltools_version, ".")[1]
694+
catch e
695+
@warn "Could not determine the version of the Command Line Tools, assuming greater than 14"
696+
global major_version = "15"
697+
end
698+
if parse(Int64, major_version) > 14
693699
o_file_flags = `-Wl,-all_load $object_files -Wl,-ld_classic`
694700
else
695701
o_file_flags = `-Wl,-all_load $object_files`
@@ -1431,7 +1437,7 @@ function bundle_julia_libexec(ctx, dest_dir)
14311437
p7zip_exe = basename(p7zip_path)
14321438
cp(p7zip_path, joinpath(bundle_libexec_dir, p7zip_exe))
14331439

1434-
return
1440+
return
14351441
end
14361442

14371443
function recursive_dir_size(path)

0 commit comments

Comments
 (0)