PackageCompiler.jl icon indicating copy to clipboard operation
PackageCompiler.jl copied to clipboard

[BUG] "Could not load library" Error and Suspected Julia Installation Breakage

Open TheCedarPrince opened this issue 3 years ago • 2 comments

Per a small discussion on the Julia Slack, I am opening an issue to track a strange error. For this issue the following specs are used:

OS: macOS Catalina 10.15.7 Julia Version: Julia 1.7.0 Package Compiler Version: v2.0.5

Additionally, here is what I have in my global Julia environment if there is any interference being caused by them in this issue:

(@v1.7) pkg> st
      Status `~/.julia/environments/v1.7/Project.toml`
  [6e4b80f9] BenchmarkTools v1.3.1
  [35a29f4d] DocumenterTools v0.1.13
  [634d3b9d] DrWatson v2.9.1
  [5fb14364] OhMyREPL v0.5.12
  [9b87118b] PackageCompiler v2.0.5
  [14b8a8f1] PkgTemplates v0.7.26
  [295af30f] Revise v3.3.3
  [0c614874] TerminalPager v0.3.0

What I do exactly to create this issue is the following steps:

  1. Create clean and empty environment
  2. Execute using PackageCompiler
  3. Execute ]activate .
  4. Add the following package ]add https://github.com/TheCedarPrince/JMentalHealthEquity#finalize-baseline
  5. Run create_sysimage(["MentalHealthEquity"]; sysimage_path = test.so")

Which leads to the following error:

julia> create_sysimage(["MentalHealthEquity"]; sysimage_path = "test.so")
⡆ [00m:24s] PackageCompiler: compiling incremental system imagecould not load library ""
dlopen(.dylib, 1): image not found
Stacktrace:
⠸ [00m:24s] PackageCompiler: compiling incremental system imageType{DecFP.Dec32}, s::String)
    @ DecFP ~/.julia/packages/DecFP/MrNNV/src/DecFP.jl:351
  [2] top-level scope
    @ ~/.julia/packages/DecFP/MrNNV/src/DecFP.jl:358
  [3] include
    @ ./Base.jl:418 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1149
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include
    @ ./Base.jl:418 [inlined]
  [8] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1149
  [9] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
 [10] top-level scope
    @ /var/folders/r8/k97v4skx6rz3_63tl1sm6gkx1294zc/T/jl_NRjWVj:44
in expression starting at /Users/jzelko3/.julia/packages/DecFP/MrNNV/src/DecFP.jl:2
in expression starting at /Users/jzelko3/.julia/packages/MySQL/0vHyV/src/MySQL.jl:1
in expression starting at /var/folders/r8/k97v4skx6rz3_63tl1sm6gkx1294zc/T/jl_NRjWVj:44
✖ [00m:24s] PackageCompiler: compiling incremental system image
ERROR: failed process: Process(`/Applications/Julia-1.7.app/Contents/Resources/julia/bin/julia --color=yes --startup-file=no --cpu-target=native -O3 --sysimage=/Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/sys.dylib --project=/Users/jzelko3/Errata/COMPILATIONTEST --output-o=/var/folders/r8/k97v4skx6rz3_63tl1sm6gkx1294zc/T/jl_JldBRr.o /var/folders/r8/k97v4skx6rz3_63tl1sm6gkx1294zc/T/jl_NRjWVj`, ProcessExited(1)) [1]

Stacktrace:
 [1] pipeline_error
   @ ./process.jl:531 [inlined]
 [2] run(::Cmd; wait::Bool)
   @ Base ./process.jl:446
 [3] run
   @ ./process.jl:444 [inlined]
 [4] #14
   @ ~/.julia/packages/PackageCompiler/wpsGv/ext/TerminalSpinners.jl:157 [inlined]
 [5] spin(f::PackageCompiler.var"#14#15"{Cmd}, s::PackageCompiler.TerminalSpinners.Spinner{Base.TTY})
   @ PackageCompiler.TerminalSpinners ~/.julia/packages/PackageCompiler/wpsGv/ext/TerminalSpinners.jl:164
 [6] macro expansion
   @ ~/.julia/packages/PackageCompiler/wpsGv/ext/TerminalSpinners.jl:157 [inlined]
 [7] create_sysimg_object_file(object_file::String, packages::Vector{String}, packages_sysimg::Set{Base.PkgId}; project::String, base_sysimage::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, extra_precompiles::String)
   @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:356
 [8] create_sysimage(packages::Vector{String}; sysimage_path::String, project::String, precompile_execution_file::Vector{String}, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, base_sysimage::Nothing, julia_init_c_file::Nothing, version::Nothing, soname::Nothing, compat_level::String, extra_precompiles::String)
   @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:507
 [9] top-level scope
   @ REPL[10]:1

It seems like something may have broken in my Julia install somewhere while working with PackageCompiler. After suspecting my installation was broken based on #424 , I installed Julia 1.7.2. The compilation now works successfully and as expected.

@KristofferC , you said this wasn't really PackageCompiler's fault. I am curious as to what you think may have happened here. Thanks!

TheCedarPrince avatar Apr 01 '22 14:04 TheCedarPrince

I really doubt this could have broken your julia installation since this shouldn't touch any julia files. Does that reproduce for you?

KristofferC avatar Apr 01 '22 14:04 KristofferC

After having used Julia 1.7.2 to create a few system images, I am not running into this issue anymore. Sadly, when I tried to installed 1.7.2 it removed my 1.7.0 installation and after looking at the Julia Downloads release page, I cannot find where to reinstall 1.7.0. So, this may have "just" been a strange fluke but at this time, I am unable to reproduce my original error. If you want to, feel free to close this @KristofferC or I can provide more details perhaps for posterity if others run into this same strange behavior. Thanks!

TheCedarPrince avatar Apr 01 '22 15:04 TheCedarPrince