Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "PackageCompiler"
uuid = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
version = "2.1.17"
version = "2.1.18"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand Down
20 changes: 18 additions & 2 deletions src/PackageCompiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,23 @@ function create_sysimg_from_object_file(object_files::Vector{String},
end
mkpath(dirname(sysimage_path))
# Prevent compiler from stripping all symbols from the shared lib.
o_file_flags = Sys.isapple() ? `-Wl,-all_load $object_files` : `-Wl,--whole-archive $object_files -Wl,--no-whole-archive`
if Sys.isapple()
try
cltools_version_cmd = `pkgutil --pkg-info=com.apple.pkg.CLTools_Executables`
cltools_version = match(r"version: (.*)\n", readchomp(cltools_version_cmd))[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can check for nothing here, rather than try/catch.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you suggest a good way to test this? If I change the --pkg-info to force a failure I get the following error, but I imagine that the "real" failure mode here is simply returning nothing. Just not sure how to go about getting my system into a state that allows me to test this before shipping it.

Screenshot 2024-04-05 at 11 17 55 AM

global major_version = split(cltools_version, ".")[1]
catch e
@warn "Could not determine the version of the Command Line Tools, assuming greater than 14"
global major_version = "15"
end
if parse(Int64, major_version) > 14
o_file_flags = `-Wl,-all_load $object_files -Wl,-ld_classic`
else
o_file_flags = `-Wl,-all_load $object_files`
end
else
o_file_flags = `-Wl,--whole-archive $object_files -Wl,--no-whole-archive`
end
extra = get_extra_linker_flags(version, compat_level, soname)
cmd = `$(bitflag()) $(march()) -shared -L$(julia_libdir()) -L$(julia_private_libdir()) -o $sysimage_path $o_file_flags $(Base.shell_split(ldlibs())) $extra`
run_compiler(cmd; cplusplus=true)
Expand Down Expand Up @@ -1421,7 +1437,7 @@ function bundle_julia_libexec(ctx, dest_dir)
p7zip_exe = basename(p7zip_path)
cp(p7zip_path, joinpath(bundle_libexec_dir, p7zip_exe))

return
return
end

function recursive_dir_size(path)
Expand Down