PackageCompiler and Plots.jl: ld warning and 16KB image

I am on a Mac (M3) with Sonoma (14.4.1), running Julia v1.10.4 and trying to use PackageCompiler.jl (v2.1.17) with Plots.jl (v1.40.4). Note I get into the same troubles with any other package I am trying to “prepackage”.

Creating a working sys image fails, as the *.so file is only 16KB and if I try to use it Julia complains that System image file failed consistency check.

The creation of the system image returns the following ld warning:

ld: warning: reexported library with install name '@rpath/libunwind.1.dylib' found at '/Users/myusernamehere/.julia/juliaup/julia-1.10.4+0.aarch64.apple.darwin14/lib/julia/libunwind.1.0.dylib' couldn't be matched with any parent library and will be linked directly

Any help would be immensely appreciated.

Can you give us a reproducible MWE?

using PackageCompiler
create_sysimage(["Plots"], sysimage_path="sys_myimage.so", include_transitive_dependencies=false, precompile_execution_file="myfile.jl")

(note: with or w/o include_transitive_dependencies=false the result is the same)

with myfile.jl containing

using Plots

x = 1:10:100
y = sin.(x)

plot(x,y, show=true)

I even tried to add to the my file.jl the initial line ENV["LD_LIBRARY_PATH"] = "" but did not make any difference.

The resulting image is 16KB in size (i.e. suspiciously small) and julia --sysimage ./sys_myimage.so returns an error:

ERROR: System image file failed consistency check: maybe opened the wrong version?

The exact same command does work, when run on a Google Colab notebook.