JuliaMolSim / Molly.jl

Molecular simulation in Julia
Other
372 stars 51 forks source link

Compilation failed for Julia 1.73 and 1.8 on Apple M1 chip #80

Closed jty-computation closed 1 year ago

jty-computation commented 1 year ago

I encountered the below error when attempting to compile Molly on the above system configurations. Let me know if there is additional information that may be of use.

julia> import Pkg; Pkg.precompile()
Precompiling project...
  ✗ BinaryProvider
  ✗ Molly
  0 dependencies successfully precompiled in 4 seconds. 152 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

Molly [aa0f7f06-fcc0-5ec4-a7f3-a573f33f9c4c]

Failed to precompile Molly [aa0f7f06-fcc0-5ec4-a7f3-a573f33f9c4c] to /Users/UserName/.julia/compiled/v1.8/Molly/jl_eOF7rH.
ERROR: LoadError: InitError: UndefVarError: libchemfiles not defined
Stacktrace:
  [1] chfl_version
    @ ~/.julia/packages/Chemfiles/QiqBE/src/generated/cdef.jl:19 [inlined]
  [2] version
    @ ~/.julia/packages/Chemfiles/QiqBE/src/Chemfiles.jl:36 [inlined]
  [3] __init__()
    @ Chemfiles ~/.julia/packages/Chemfiles/QiqBE/src/Chemfiles.jl:145
  [4] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base ./loading.jl:831
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
    @ Base ./loading.jl:1039
  [6] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1315
  [7] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [8] macro expansion
    @ ./loading.jl:1180 [inlined]
  [9] macro expansion
    @ ./lock.jl:223 [inlined]
 [10] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
 [11] include
    @ ./Base.jl:422 [inlined]
 [12] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1554
 [13] top-level scope
    @ stdin:1
during initialization of module Chemfiles
in expression starting at /Users/UserName/.julia/packages/Molly/GBoZA/src/Molly.jl:1
in expression starting at stdin:1
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
 [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{String}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1427
 [3] precompile
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1058 [inlined]
 [4] #precompile#225
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1057 [inlined]
 [5] precompile (repeats 2 times)
   @ /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Pkg/src/API.jl:1057 [inlined]
 [6] top-level scope
   @ REPL[1]:1
jgreener64 commented 1 year ago

Thanks for reporting. Looks like it might be an issue with Chemfiles.jl. Could you try Pkg.add("Chemfiles") and using Chemfiles?

jty-computation commented 1 year ago
(@v1.8) pkg> add Chemfiles
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`

julia> Pkg.add("Chemfiles"); using Chemfiles
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`
ERROR: InitError: UndefVarError: libchemfiles not defined
Stacktrace:
  [1] chfl_version
    @ ~/.julia/packages/Chemfiles/QiqBE/src/generated/cdef.jl:19 [inlined]
  [2] version
    @ ~/.julia/packages/Chemfiles/QiqBE/src/Chemfiles.jl:36 [inlined]
  [3] __init__()
    @ Chemfiles ~/.julia/packages/Chemfiles/QiqBE/src/Chemfiles.jl:145
  [4] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base ./loading.jl:831
  [5] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
    @ Base ./loading.jl:1039
  [6] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1315
  [7] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [8] macro expansion
    @ ./loading.jl:1180 [inlined]
  [9] macro expansion
    @ ./lock.jl:223 [inlined]
 [10] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
during initialization of module Chemfiles
jgreener64 commented 1 year ago

Looks like a Chemfiles issue that others have run into too: https://github.com/chemfiles/Chemfiles.jl/issues/56.

Hopefully there will be resolution soon on the linked issue, I will keep this issue open as this does stop Molly working on M1 chips.

jty-computation commented 1 year ago

For future reference:

julia> versioninfo()
Julia Version 1.8.0-rc3
Commit 33f19bcbd25 (2022-07-13 19:10 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin21.3.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, apple-m1)
  Threads: 8 on 4 virtual cores
Environment:
  JULIA_NUM_THREADS = 8
jgreener64 commented 1 year ago

As mentioned on the other issue, this should be fixed in Chemfiles 0.10.3.