Unable to create shared libraries or custom sysimages with PackageCompiler in ubuntu

I’m trying to create a small app using Julia.
This is the repo:

I ventured into the packagecompiler.jl documentation, I tried to follow all the steps, unfortunately I get an error:

$ julia --startup-file=no --output-o myapp.o -J"/opt/julia-1.4.2/lib/julia/sys.so" custom_sysimage.jl

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:967
uv_write at ./stream.jl:924
unsafe_write at ./stream.jl:1007
write at ./strings/io.jl:183 [inlined]
print at ./strings/io.jl:185 [inlined]
#with_output_color#701 at ./util.jl:389
unknown function (ip: 0x7f797af15856)
with_output_color##kw at ./util.jl:383 [inlined]
#printstyled#702 at ./util.jl:417 [inlined]
printstyled##kw at ./util.jl:417
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2159 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2323
display_error at ./client.jl:102
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2159 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2323
display_error at ./client.jl:106
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2159 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2323
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1700 [inlined]
do_apply at /buildworker/worker/package_linux64/build/src/builtins.c:643
jl_f__apply_latest at /buildworker/worker/package_linux64/build/src/builtins.c:693
#invokelatest#1 at ./essentials.jl:712 [inlined]
invokelatest at ./essentials.jl:711 [inlined]
exec_options at ./client.jl:290
_start at ./client.jl:484
unknown function (ip: 0x7f797b5cbaec)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2159 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2323
unknown function (ip: 0x401931)
unknown function (ip: 0x401533)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4015d4)
Allocations: 852487 (Pool: 851983; Big: 504); GC: 1
Segmentation fault (core dumped)

I’m using Ubuntu 18.04 and Julia 1.14:

$ julia --v
julia version 1.4.2

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic

I also tried to create simple shared libraby (without the custom image)

using MyApp
using PackageCompiler
create_sysimage([:MyApp];sysimage_path="sysimage_myapp.dylib")

and I also get this error

julia> create_sysimage([:MyApp];sysimage_path=“sysimage_myapp.dylib”)
┌ Warning: Package MyApp does not have Dates in its dependencies:
│ - If you have MyApp checked out for development and have
│ added Dates as a dependency but haven’t updated your primary
│ environment’s manifest file, try Pkg.resolve().
│ - Otherwise you may need to report an issue with MyApp
└ Loading Dates into MyApp from project dependency, future warnings for MyApp are suppressed.
[ Info: PackageCompiler: creating system image object file, this might take a while…
ERROR: LoadError: LoadError: ArgumentError: Package MyApp does not have Dates in its dependencies:

  • If you have MyApp checked out for development and have
    added Dates as a dependency but haven’t updated your primary
    environment’s manifest file, try Pkg.resolve().
  • Otherwise you may need to report an issue with MyApp
    Stacktrace:
    [1] require(::Module, ::Symbol) at ./loading.jl:905
    [2] include(::Module, ::String) at ./Base.jl:377
    [3] include(::String) at /home/jorgedevpc/Code/github/alvaradojl/julia-microservice/src/MyApp.jl:1
    [4] top-level scope at /home/jorgedevpc/Code/github/alvaradojl/julia-microservice/src/MyApp.jl:14
    [5] include(::Module, ::String) at ./Base.jl:377
    [6] _require(::Base.PkgId) at ./loading.jl:1058
    [7] require(::Base.PkgId) at ./loading.jl:927
    [8] require(::Module, ::Symbol) at ./loading.jl:922
    in expression starting at /home/jorgedevpc/Code/github/alvaradojl/julia-microservice/src/Server.jl:3
    in expression starting at /home/jorgedevpc/Code/github/alvaradojl/julia-microservice/src/MyApp.jl:14
    ERROR: failed process: Process(`/opt/julia-1.4.2/bin/julia --color=yes --startup-file=no --cpu-target=native --sysimage=/opt/julia-1.4.2/lib/julia/sys.so --project=/home/jorgedevpc/Code/github/alvaradojl/julia-microservice --output-o=/tmp/jl_kbNnQF.o -e 'Base.reinit_stdio()
    @eval Sys BINDIR = ccall(:jl_get_julia_bindir, Any, ())::String
    Base.init_load_path()
    Base.init_depot_path()
    import MyApp

This @eval prevents symbols from being put into Main

@eval Module() begin
PrecompileStagingArea = Module()
for (_pkgid, _mod) in Base.loaded_modules
if !(_pkgid.name in (“Main”, “Core”, “Base”))
eval(PrecompileStagingArea, :(const (Symbol(_mod)) = _mod))
end
end
precompile_statements = String
append!(precompile_statements, readlines("/tmp/jl_cNE87Y"))

for statement in sort(precompile_statements)
    # println(statement)
    try
        Base.include_string(PrecompileStagingArea, statement)
    catch
        # See julia issue #28808
        @debug "failed to execute $statement"
    end
end

end # module
empty!(LOAD_PATH)
empty!(DEPOT_PATH)
'`, ProcessExited(1)) [1]

Stacktrace:
[1] pipeline_error at ./process.jl:525 [inlined]
[2] run(::Cmd; wait::Bool) at ./process.jl:440
[3] run at ./process.jl:438 [inlined]
[4] create_sysimg_object_file(::String, ::Array{String,1}; project::String, base_sysimage::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, cpu_target::String, script::Nothing, isapp::Bool) at /home/jorgedevpc/.julia/packages/PackageCompiler/vsMJE/src/PackageCompiler.jl:292
[5] create_sysimage(::Array{Symbol,1}; sysimage_path::String, project::String, precompile_execution_file::Array{String,1}, precompile_statements_file::Array{String,1}, incremental::Bool, filter_stdlibs::Bool, replace_default::Bool, cpu_target::String, script::Nothing, base_sysimage::Nothing, isapp::Bool) at /home/jorgedevpc/.julia/packages/PackageCompiler/vsMJE/src/PackageCompiler.jl:423
[6] top-level scope at REPL[4]:1

can you fix this error?

I can’t see Dates in https://github.com/alvaradojl/julia-microservice/blob/master/Project.toml