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

QML errors on Ubuntu aarch64

Open JanisErdmanis opened this issue 1 year ago • 2 comments

I have Ubuntu aarch64 installed through Parallels Desktop and noticed an error when launching a simple QML application on this platform:

julia> include("main.jl")
ERROR: LoadError: InitError: type RefArray has no field cpp_object
Stacktrace:
  [1] getproperty
    @ ./Base.jl:49 [inlined]
  [2] unsafe_convert(to_type::Type{CxxWrap.CxxWrapCore.CxxPtr{…}}, x::Base.RefArray{Ptr{…}, Vector{…}, Vector{…}})
    @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/eWADG/src/CxxWrap.jl:294
  [3] getargv(a::QML.ArgcArgv)
    @ QML ~/.julia/packages/QML/SeDxf/src/QML.jl:158
  [4] __init__()
    @ QML ~/.julia/packages/QML/SeDxf/src/QML.jl:181
  [5] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1262
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1250
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{…}, ignore_native::Nothing)
    @ Base ./loading.jl:1195
  [8] _include_from_serialized
    @ ./loading.jl:1152 [inlined]
  [9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{…}, DEPOT_PATH::Vector{…})
    @ Base ./loading.jl:1914
 [10] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2346
 [11] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2216
 [12] #invoke_in_world#3
    @ ./essentials.jl:1077 [inlined]
 [13] invoke_in_world
    @ ./essentials.jl:1074 [inlined]
 [14] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2207
 [15] macro expansion
    @ ./loading.jl:2146 [inlined]
 [16] macro expansion
    @ ./lock.jl:273 [inlined]
 [17] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2103
 [18] #invoke_in_world#3
    @ ./essentials.jl:1077 [inlined]
 [19] invoke_in_world
    @ ./essentials.jl:1074 [inlined]
 [20] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2096
 [21] include(fname::String)
    @ Main ./sysimg.jl:38
 [22] top-level scope
    @ REPL[1]:1
during initialization of module QML
in expression starting at /media/psf/Home/Desktop/JuliaCon2024-AppBundler-Demo/QMLApp/main.jl:1
Some type information was truncated. Use `show(err)` to see complete types.

JanisErdmanis avatar Jul 02 '24 22:07 JanisErdmanis

On which hardware did you test this? How can it be reproduced?

ufechner7 avatar Sep 09 '24 14:09 ufechner7

It was tested on Apple silicon via Parallels desktop.

JanisErdmanis avatar Sep 09 '24 16:09 JanisErdmanis

Could it be that you're using an old version of QML? I got the same errors, see https://github.com/barche/QmlJuliaExamples/issues/14

jonalm avatar Sep 29 '24 16:09 jonalm

I investigated this case because I had previously overlooked how I had used Manifest.toml between Julia versions. I found that I had QML was fixed at 0.9.0. Removing the old Manifest.toml and instantiating the project fresh with Julia 1.11, where QML is now at 0.9.1, sadly, produces the same error.

JanisErdmanis avatar Sep 29 '24 17:09 JanisErdmanis

I would not expect it to work with 1.11-rc . 1.11 is not released yet. Can you repeat the test with Julia 1.10 ?

juliaup install 1.10
juliaup default 1.10

ufechner7 avatar Sep 29 '24 17:09 ufechner7

I just tried that. The same error is thrown with Julia 1.10.

JanisErdmanis avatar Sep 29 '24 18:09 JanisErdmanis

I also reproduced the same error on Raspberry Pi 4 in headless mode. In my opinion, one step forward would be to create an integration test that runs on CI.

JanisErdmanis avatar Sep 29 '24 18:09 JanisErdmanis

@barche Do we officially support aarch64? If not we should mention it in the README.md. If we want to support it we need to debug this issue. I have a PI5 for testing, but I do not know if there are any servers that could do the testing on CI.

ufechner7 avatar Sep 29 '24 19:09 ufechner7

I can't see an obvious reason why it wouldn't work, but I don't have a machine to test it on.

barche avatar Oct 02 '24 14:10 barche

@barche, could we add aarch64 to .github/workflows/test.yml, which seems to be left out for Ubuntu?

JanisErdmanis avatar Oct 02 '24 17:10 JanisErdmanis

The same issue occurs on Arch Linux WSL2 environment as well.

julia> include("gui.jl") # Or any of the files in the directory
ERROR: LoadError: InitError: type RefArray has no field cpp_object
Stacktrace:
  [1] getproperty
    @ ./Base.jl:49 [inlined]
  [2] unsafe_convert(to_type::Type{CxxWrap.CxxWrapCore.CxxPtr{…}}, x::Base.RefArray{Ptr{…}, Vector{…}, Vector{…}})
    @ CxxWrap.CxxWrapCore ~/.julia/packages/CxxWrap/5IZvn/src/CxxWrap.jl:271
  [3] getargv(a::QML.ArgcArgv)
    @ QML ~/.julia/packages/QML/ZVeBh/src/QML.jl:133
  [4] __init__()
    @ QML ~/.julia/packages/QML/ZVeBh/src/QML.jl:156
  [5] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1336
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1324
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any}, ignore_native::Nothing; register::Bool)
    @ Base ./loading.jl:1213
  [8] _include_from_serialized (repeats 2 times)
    @ ./loading.jl:1169 [inlined]
  [9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128, stalecheck::Bool; reasons::Dict{…}, DEPOT_PATH::Vector{…})
    @ Base ./loading.jl:1975
 [10] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:2435
 [11] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2300
 [12] #invoke_in_world#3
    @ ./essentials.jl:1088 [inlined]
 [13] invoke_in_world
    @ ./essentials.jl:1085 [inlined]
 [14] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:2287
 [15] macro expansion
    @ ./loading.jl:2226 [inlined]
 [16] macro expansion
    @ ./lock.jl:273 [inlined]
 [17] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2183
 [18] #invoke_in_world#3
    @ ./essentials.jl:1088 [inlined]
 [19] invoke_in_world
    @ ./essentials.jl:1085 [inlined]
 [20] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:2176
 [21] include(fname::String)
    @ Main ./sysimg.jl:38
 [22] top-level scope
    @ REPL[5]:1
during initialization of module QML
in expression starting at /home/bellq/project/QmlJuliaExamples/basic/gui.jl:2
Some type information was truncated. Use `show(err)` to see complete types.

kn05 avatar Oct 11 '24 05:10 kn05

I tried adding aarch64 for Ubuntu, but it seems the Github CI runners don't support this, it tries to run aarch64 Julia on an x86_64 Ubuntu:

https://github.com/JuliaGraphics/QML.jl/actions/runs/11304271459/job/31442445149?pr=208

barche avatar Oct 12 '24 08:10 barche

I have been able to reproduce this on my Raspberry Pi 4. It is a bug in CxxWrap, due to different typing in the C++ argv somehow. Still looking for a solution.

barche avatar Oct 13 '24 15:10 barche

I really appreciate your efforts. Were you able to make any progress regarding this issue ? I encounter the exact same error message using Julia 1.11 on Windows 10.

GaavNa avatar Oct 31 '24 21:10 GaavNa

@GaavNa, are you running Windows on arm64?

JanisErdmanis avatar Oct 31 '24 22:10 JanisErdmanis

@GaavNa, are you running Windows on arm64?

No, Intel. It didn't work on two computer with Intel and Windows.

However, it worked on Debian 12 using an intel CPU.

GaavNa avatar Nov 01 '24 08:11 GaavNa

@GaavNa, you should open a separate issue laying out the configuration that could help us reproduce it, along with the Julia version you have used. In my Windows environment, QML works. Thus, such a bug report would be valuable. Also, trying Julia from a fresh start is worthwhile, as I have encountered some binary Artifact locking situations in the past.

JanisErdmanis avatar Nov 01 '24 10:11 JanisErdmanis

Still no clear idea on what causes this, I think it's actually a problem in CxxWrap.jl and the convert methods there.

barche avatar Nov 03 '24 21:11 barche

I think applying the changes in CxxWrap.jl from this commit will fix this: https://github.com/JuliaInterop/CxxWrap.jl/commit/c9e113c2b128fbd055988fb7c7cff5c213a86c52

You can try this by manually patching the CxxWrap.jl file.

barche avatar Nov 11 '24 19:11 barche

I finally had time to test the patch. It works well on my Ubuntu aarch64 VM installation. Is there any reason why the patch is not integrated into CxxWrap?

JanisErdmanis avatar Feb 11 '25 18:02 JanisErdmanis

I'm taking far longer than expected for the 0.17 release of CxxWrap, so maybe it is indeed beste to just backport this as a point release in 0.16.

barche avatar Feb 12 '25 15:02 barche

Should be OK now!

barche avatar Feb 12 '25 17:02 barche