Skip to content

Commit 5f6d7f9

Browse files
jayscookPhilReinhold
authored andcommitted
Check for versions ≥ 15, handle pkgutil error
Co-authored-by: Jay Cook <john.cook@betterment.com> Co-authored-by: Phil Reinhold <pcreinhold@gmail.com>
1 parent 75d94e8 commit 5f6d7f9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/PackageCompiler.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,9 +712,15 @@ function create_sysimg_from_object_file(object_files::Vector{String},
712712
mkpath(dirname(sysimage_path))
713713
# Prevent compiler from stripping all symbols from the shared lib.
714714
if Sys.isapple()
715-
cltools_version_cmd = `pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`
716-
cltools_version = match(r"version: (.*)\n", readchomp(cltools_version_cmd))[1]
717-
if startswith(cltools_version, "15")
715+
try
716+
cltools_version_cmd = `pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`
717+
cltools_version = match(r"version: (.*)\n", readchomp(cltools_version_cmd))[1]
718+
global major_version = split(cltools_version, ".")[1]
719+
catch e
720+
@warn "Could not determine the version of the Command Line Tools, assuming greater than 14"
721+
global major_version = "15"
722+
end
723+
if parse(Int64, major_version) > 14
718724
o_file_flags = `-Wl,-all_load $object_files -Wl,-ld_classic`
719725
else
720726
o_file_flags = `-Wl,-all_load $object_files`

0 commit comments

Comments
 (0)