Creating sysimage fails on the Vagrant machine (Ubuntu)


Today is the first time I created a custom sysimage on my Mac, and it works like a charm. Given how much I like it, I tried also creating it on a Vagrant machine that is running Ubuntu. It keeps failing for some reason. Here is the output from my latest try. I don’t understand these things well. If someone knows, can you please clarify what is going wrong. Thank you.

(I am using Julia 1.5.4.)

julia> create_sysimage([:CSV, :DataFrames, :StatsBase, :OrderedCollections, :Crayons], sysimage_path = "myimg.dylib", precompile_execution_file = "MyImg2.jl")
[ Info: PackageCompiler: creating system image object file, this might take a while...
ERROR: failed process: Process(`/home/vagrant/applications/julia-1.5.4/bin/julia --color=yes --startup-file=no --cpu-target=native --sysimage=/home/vagrant/applications/julia-1.5.4/lib/julia/ --project=/home/vagrant/.julia/environments/v1.5 --output-o=/tmp/jl_6UEDj6.o -e 'Base.reinit_stdio()
@eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
@eval Sys STDLIB = "/home/vagrant/applications/julia-1.5.4/share/julia/stdlib/v1.5"
if isdefined(Base, :init_active_project)
import CSV
import DataFrames
import StatsBase
import OrderedCollections
import Crayons
# This @eval prevents symbols from being put into Main
@eval Module() begin
    PrecompileStagingArea = Module()
    for (_pkgid, _mod) in Base.loaded_modules
        if !( in ("Main", "Core", "Base"))
            eval(PrecompileStagingArea, :(const $(Symbol(_mod)) = $_mod))
    precompile_files = String[
    for file in precompile_files, statement in eachline(file)
        # println(statement)
        # The compiler has problem caching signatures with \`Vararg{?, N}\`. Replacing
        # N with a large number seems to work around it.
        statement = replace(statement, r"Vararg{(.*?), N} where N" => s"Vararg{\1, 100}")
            Base.include_string(PrecompileStagingArea, statement)
            # See julia issue #28808
            @debug "failed to execute $statement"
end # module
'`, ProcessSignaled(9)) [0]

Just wanted to add that since using PackageCompiler did not work, I also tried with the steps given here
(Creating a sysimage · PackageCompiler) which does not use PackageCompiler. At the very first step I get a segmentation fault:

signal (11): Segmentation fault
in expression starting at none:0
uv_write2 at /workspace/srcdir/libuv/src/unix/stream.c:1397
uv_write at /workspace/srcdir/libuv/src/unix/stream.c:1492
jl_uv_write at /buildworker/worker/package_linux64/build/src/jl_uv.c:463
uv_write_async at ./stream.jl:965
uv_write at ./stream.jl:922
unsafe_write at ./stream.jl:1005
write at ./strings/io.jl:183 [inlined]
print at ./strings/io.jl:185 [inlined]
#with_output_color#745 at ./util.jl:76
unknown function (ip: 0x7f5fdd0d9238)
with_output_color##kw at ./util.jl:70 [inlined]
#printstyled#746 at ./util.jl:104 [inlined]
printstyled##kw at ./util.jl:104
unknown function (ip: 0x7f5fdd0d8c17)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2231 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2398
display_error at ./client.jl:102
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2231 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2398
display_error at ./client.jl:106
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2231 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2398
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1691 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:674
jl_f__apply_latest at /buildworker/worker/package_linux64/build/src/builtins.c:724
#invokelatest#1 at ./essentials.jl:710 [inlined]
invokelatest at ./essentials.jl:709 [inlined]
exec_options at ./client.jl:298
_start at ./client.jl:506
unknown function (ip: 0x7f5fdd8a27cb)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2231 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2398
jl_apply at /buildworker/worker/package_linux64/build/ui/../src/julia.h:1691 [inlined]
true_main at /buildworker/worker/package_linux64/build/ui/repl.c:106
main at /buildworker/worker/package_linux64/build/ui/repl.c:227
__libc_start_main at /lib/x86_64-linux-gnu/ (unknown line)
_start at /home/vagrant/applications/julia-1.5.4/bin/julia (unknown line)
Allocations: 852172 (Pool: 851695; Big: 477); GC: 1
Segmentation fault (core dumped)

No comments on this? Is this a bug? I realize I should have included the code here from the file I am using. It is as follows. When I tried using the PackageCompiler I did not have the three Base. lines. Since the PackageCompiler failed because of the error shown in my first post above, I tried without the PackageCompiler. That gave a segmentation fault shown in my second post above.

module MyImg2


import CSV
import DataFrames
import StatsBase; Sb = StatsBase
import OrderedCollections
import Crayons

function main()
    df ="nums.csv", DataFrames.DataFrame)
    df.sqrs = df.nums .* df.nums
    df.cubes = df.sqrs .* df.nums
    return df