Problems installing QML on M1 machine

I’ve been trying to install QML on my M1 MacBook Pro. However, it always fails at the precompiling step. I get the following error:

ERROR: LoadError: UndefVarError: libjlqml not defined
Stacktrace:
 [1] top-level scope
   @ ~/.julia/packages/QML/QJmAc/src/QML.jl:30
 [2] include
   @ ./Base.jl:418 [inlined]
 [3] 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:1318
 [4] top-level scope
   @ none:1
 [5] eval
   @ ./boot.jl:373 [inlined]
 [6] eval(x::Expr)
   @ Base.MainInclude ./client.jl:453
 [7] top-level scope
   @ none:1
in expression starting at /Users/werk/.julia/packages/QML/QJmAc/src/QML.jl:1
ERROR: Failed to precompile QML [2db162a6-7e43-52c3-8d84-290c1c42d82a] to /Users/werk/.julia/compiled/v1.7/QML/jl_4rNMJU.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] eval
    @ ./boot.jl:373 [inlined]
  [8] eval
    @ ./Base.jl:68 [inlined]
  [9] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/repl.jl:157
 [10] (::VSCodeServer.var"#78#80"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/repl.jl:123
 [11] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:511
 [12] with_logger
    @ ./logging.jl:623 [inlined]
 [13] (::VSCodeServer.var"#77#79"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/repl.jl:124
 [14] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [15] invokelatest(::Any)
    @ Base ./essentials.jl:714
 [16] macro expansion
    @ ~/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
 [17] (::VSCodeServer.var"#60#61")()
    @ VSCodeServer ./task.jl:423

I tried building jlqml myself, which seems to have gone fine. I added it to Overrides.toml as documented and I added jlqml_jll as a package afterwards. Still, when trying the command “using QML” I get the error mentioned above.

Any help would be greatly appreciated!

@barche I guess we need to build qt5declarative for this architecture:
https://github.com/JuliaPackaging/Yggdrasil/blob/aaec98291b41c2ed3a9a4bfdd8bfacbf62d8ee0a/J/jlqml/build_tarballs.jl#L56-L58
?

Yes, and probably the other Qt5 jlls as well, not sure why they were disabled.

Anything I can do myself to get it working in the short term?

I assume you’re the using M1 Julia build, i.e. for ARM, and that’s the problem, so to answer for the “short term”, I would try the x86-64 Julia build. Rosetta 2 is supposed to handle x86-64, including that regular fully supported Julia, or at least I would give it a try (curious if it works for you).

Damn, don’t know why I didn’t think of that. Thanks, that does indeed work! It is sadly a good bit slower for my purposes, however, so that’s a shame.

Now I don’t know how I can make VsCode start the x86 repl though… (apart from connecting to the one I installed as an external repl).

I think you can just set the Julia path in the vscode settings to the x86 one. Note that @giordano and I started the work to add the M1 platform to the JLL, should be done soon.

3 Likes

Yes, you’re right, I didn’t look closely enough. I only looked at the environment path, which doesn’t work. I now indeed set the executable path, which does work, thanks for that.

Also thanks for working this out on such short notice!

It should work on M1 now, I haven’t tested this because I don’t have an M1 machine. The speed is entirely thanks to @giordano 's superhuman efforts in keeping on top of Yggdrasil.

2 Likes

Had to do a clean install of Julia, but it seems to work now! Thanks guys!

1 Like

Actually, it’s not working completely like it should. If I start my script with “Using QML” at the top (without any QML specific code), my REPL seems to crash, and throws

signal (11): Segmentation fault: 11
in expression starting at /Users/werk/Documents/PhD/Julia Projects/Ising/main.jl:59
ntuple at ./ntuple.jl:0 [inlined]
uniform_name_type at /Users/werk/.julia/packages/GLMakie/TfSB1/src/GLAbstraction/GLUniforms.jl:139
compile_program at /Users/werk/.julia/packages/GLMakie/TfSB1/src/GLAbstraction/GLShader.jl:189
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#54 at /Users/werk/.julia/packages/GLMakie/TfSB1/src/GLAbstraction/GLShader.jl:246
get! at ./dict.jl:464
unknown function (ip: 0x11401acc3)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
gl_convert at /Users/werk/.julia/packages/GLMakie/TfSB1/src/GLAbstraction/GLShader.jl:238
RenderObject at /Users/werk/.julia/packages/GLMakie/TfSB1/src/GLAbstraction/GLTypes.jl:347
RenderObject at /Users/werk/.julia/packages/GLMakie/TfSB1/src/GLAbstraction/GLTypes.jl:321 [inlined]
OIT_postprocessor at /Users/werk/.julia/packages/GLMakie/TfSB1/src/postprocessing.jl:43
#Screen#54 at /Users/werk/.julia/packages/GLMakie/TfSB1/src/screen.jl:360
Screen at /Users/werk/.julia/packages/GLMakie/TfSB1/src/screen.jl:303 [inlined]
global_gl_screen at /Users/werk/.julia/packages/GLMakie/TfSB1/src/screen.jl:249 [inlined]
global_gl_screen at /Users/werk/.julia/packages/GLMakie/TfSB1/src/screen.jl:394
global_gl_screen at /Users/werk/.julia/packages/GLMakie/TfSB1/src/screen.jl:393 [inlined]
backend_display at /Users/werk/.julia/packages/GLMakie/TfSB1/src/display.jl:2 [inlined]
display at /Users/werk/.julia/packages/Makie/lgPZh/src/display.jl:59
#display#917 at /Users/werk/.julia/packages/Makie/lgPZh/src/display.jl:53 [inlined]
display at /Users/werk/.julia/packages/Makie/lgPZh/src/display.jl:53 [inlined]
loopPlot at /Users/werk/Documents/PhD/Julia Projects/Ising/main.jl:40
main at /Users/werk/Documents/PhD/Julia Projects/Ising/main.jl:56
unknown function (ip: 0x113ea5cff)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
do_call at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
eval_body at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_interpret_toplevel_thunk at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_toplevel_eval_flex at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_toplevel_eval_flex at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_toplevel_eval_in at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
eval at ./boot.jl:373 [inlined]
include_string at ./loading.jl:1196
include_string at ./loading.jl:1206
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_f__call_latest at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
do_apply at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#invokelatest#2 at ./essentials.jl:716
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
do_apply at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
invokelatest at ./essentials.jl:714
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
do_apply at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#inlineeval#70 at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/eval.jl:211
inlineeval##kw at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/eval.jl:209 [inlined]
#65 at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/eval.jl:155
withpath at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/repl.jl:184
#64 at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/eval.jl:153
hideprompt at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/repl.jl:36
#63 at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/eval.jl:124
unknown function (ip: 0x113dd92b7)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
with_logstate at ./logging.jl:511
with_logger at ./logging.jl:623 [inlined]
#62 at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/eval.jl:201
unknown function (ip: 0x113dd6fc7)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_f__call_latest at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
do_apply at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
macro expansion at /Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
#60 at ./task.jl:423
unknown function (ip: 0x113db266f)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
start_task at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
Allocations: 166998294 (Pool: 166958955; Big: 39339); GC: 88

Moreover, VScode gives me the following message

The terminal process "julia '-i', '--banner=no', '--project=/Users/werk/.julia/environments/v1.7', '/Users/werk/.vscode/extensions/julialang.language-julia-1.6.17/scripts/terminalserver/terminalserver.jl', '/var/folders/fq/y213h3_93lzfm9nczr3wdm_c0000gp/T/vsc-jl-repl-6dbd5a9e-b532-4ed8-9e97-ea0c074446a6', '/var/folders/fq/y213h3_93lzfm9nczr3wdm_c0000gp/T/vsc-jl-cr-24cc4739-b65c-4708-9367-5a968960943e', 'USE_REVISE=true', 'USE_PLOTPANE=true', 'USE_PROGRESS=true', 'DEBUG_MODE=false'" terminated with exit code: 139.

If I start my code with using QML commented out it runs fine. Then once it has run, I can just add using QML again and it runs fine…

Julia 1.7 on the M1 suffers from segmentation faults like that:
https://github.com/JuliaLang/julia/issues/41440
This has been fixed in the upcoming v1.8.

1 Like

Thanks,

I just tried the 1.8 beta, but I’m getting this error when using QML

ERROR: LoadError: ccall method definition: argument 2 type doesn't correspond to a C type
Stacktrace:
 [1] top-level scope
   @ none:1
 [2] eval
   @ ./boot.jl:368 [inlined]
 [3] wrap_functions(functions::Vector{CxxWrap.CxxWrapCore.CppFunctionInfo}, julia_mod::Module)
   @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/ptbgM/src/CxxWrap.jl:696
 [4] wrapfunctions(jlmod::Module)
   @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/ptbgM/src/CxxWrap.jl:713
 [5] top-level scope
   @ ~/.julia/packages/QML/QJmAc/src/QML.jl:36
 [6] include
   @ ./Base.jl:422 [inlined]
 [7] 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:1400
 [8] top-level scope
   @ stdin:1
in expression starting at /Users/werk/.julia/packages/QML/QJmAc/src/QML.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile QML [2db162a6-7e43-52c3-8d84-290c1c42d82a] to /Users/werk/.julia/compiled/v1.8/QML/jl_NwJMpU.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1551
 [3] compilecache
   @ ./loading.jl:1495 [inlined]
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1199
 [5] _require_prelocked(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1084
 [6] macro expansion
   @ ./loading.jl:1064 [inlined]
 [7] macro expansion
   @ ./lock.jl:223 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1028

Are you aware of this?

Likely a bug in the package.

1 Like

This is a bug in CxxWrap that is fixed in main, can you try with add CxxWrap#main?

2 Likes

That works actually, thanks so much! I did try updating CxxWrap, and I assumed it would be pulled from the main branch, but I guess that’s not the case? I’m kind of new to Github etc. so sorry for my ignorance, but why does add CxxWrap#main install something else then just running add CxxWrap?

With CxxWrap#main you get the latest commit in the git repository, otherwise you get the latest version that was released.

1 Like

I see, that makes sense. Thanks!

1 Like