-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempting to compile with PackageCompilerX #15
Comments
I guess my key question is whether there's anything inherently limiting about the implementation of CImGui.jl w.r.t. PackageCompilerX's approach? |
It is not very strange that things like
fail to precompile since those functions only exist in the script and not in the resulting sysimage. In fact, we should probably filter out all precompilation statements that gets defined in Main. I don't know why the UI doesn't work properly though. Is it possible to get any debug messages out of ClmGui? Perhaps some state is not being set properly. |
I'm trying to compile this simple app using PackageCompilerX, but it complains about:
How could I tell it to find the artifacts that used by its dependency packages? |
I don't think it's a good idea to compile |
You shouldn't need to do anything. The error message is a bit strange since the artifact |
Okay, that package doesn't have any artifact for macOS so we shouldn't try bundle it in that case. |
Should be fixed by JuliaLang/PackageCompilerX.jl#69. |
@KristofferC Thanks for the quick fix! Now I hit some ➜ App git:(compile) ✗ julia -q --project
julia> using PackageCompilerX
[ Info: Precompiling PackageCompilerX [dffaa6cc-da53-48e5-b007-4292dfcc27f1]
shell> cd ..
/Users/gnimuc/.julia/dev/Redux/examples
julia> create_app("App", "AppCompiled")
┌ Warning: Package ModernGL has a build script, this might indicate that it is not relocatable
└ @ PackageCompilerX ~/.julia/dev/PackageCompilerX/src/PackageCompilerX.jl:369
[ Info: PackageCompilerX: creating base system image (incremental=false)...
[ Info: PackageCompilerX: creating system image object file, this might take a while...
[ Info: PackageCompilerX: creating system image object file, this might take a while...
ERROR: LoadError: LoadError: error compiling igGET_FLT_MAX: could not load library "@rpath/libcimgui.dylib"
dlopen(@rpath/libcimgui.dylib, 1): image not found
Stacktrace:
[1] top-level scope at /Users/gnimuc/.julia/packages/CImGui/M9ITG/src/CImGui.jl:22
[2] include at ./boot.jl:328 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1105
[4] _require(::Base.PkgId) at ./loading.jl:1053
[5] require(::Base.PkgId) at ./loading.jl:922
[6] require(::Module, ::Symbol) at ./loading.jl:917
[7] include at ./boot.jl:328 [inlined]
[8] include_relative(::Module, ::String) at ./loading.jl:1105
[9] _require(::Base.PkgId) at ./loading.jl:1053
[10] require(::Base.PkgId) at ./loading.jl:922
[11] require(::Module, ::Symbol) at ./loading.jl:917
in expression starting at /Users/gnimuc/.julia/packages/CImGui/M9ITG/src/CImGui.jl:22
in expression starting at /Users/gnimuc/.julia/dev/Redux/examples/App/src/App.jl:4
caused by [exception 1]
could not load library "@rpath/libcimgui.dylib"
dlopen(@rpath/libcimgui.dylib, 1): image not found
Stacktrace:
[1] top-level scope at /Users/gnimuc/.julia/packages/CImGui/M9ITG/src/CImGui.jl:22
[2] include at ./boot.jl:328 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1105
[4] _require(::Base.PkgId) at ./loading.jl:1053
[5] require(::Base.PkgId) at ./loading.jl:922
[6] require(::Module, ::Symbol) at ./loading.jl:917
[7] include at ./boot.jl:328 [inlined]
[8] include_relative(::Module, ::String) at ./loading.jl:1105
[9] _require(::Base.PkgId) at ./loading.jl:1053
[10] require(::Base.PkgId) at ./loading.jl:922
[11] require(::Module, ::Symbol) at ./loading.jl:917
ERROR: failed process: Process(`/Applications/Julia-1.3.app/Contents/Resources/julia/bin/julia --color=yes --startup-file=no --compiled-modules=no '--cpu-target=generic;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)' --sysimage=/var/folders/ft/nd_bm3z52152069y78vb71280000gn/T/jl_E1ghWV/tmp_sys.so --project=/Users/gnimuc/.julia/dev/Redux/examples/App --output-o=/var/folders/ft/nd_bm3z52152069y78vb71280000gn/T/jl_eyh60I.o -e 'Base.reinit_stdio()
Base.init_load_path()
Base.init_depot_path()
using App
# 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("/var/folders/ft/nd_bm3z52152069y78vb71280000gn/T/jl_SeD3MB"))
for statement in sort(precompile_statements)
# println(statement)
try
Base.include_string(PrecompileStagingArea, statement)
catch
# See julia issue #28808
@error "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#565(::Bool, ::typeof(run), ::Cmd) at ./process.jl:440
[3] run at ./process.jl:438 [inlined]
[4] #create_sysimg_object_file#4(::String, ::String, ::Array{String,1}, ::Array{String,1}, ::String, ::Bool, ::typeof(PackageCompilerX.create_sysimg_object_file), ::String, ::Array{Symbol,1}) at /Users/gnimuc/.julia/dev/PackageCompilerX/src/PackageCompilerX.jl:167
[5] #create_sysimg_object_file at ./none:0 [inlined]
[6] #create_sysimage#5(::String, ::String, ::Array{String,1}, ::Array{String,1}, ::Bool, ::Bool, ::Bool, ::String, ::String, ::Bool, ::typeof(create_sysimage), ::Symbol) at /Users/gnimuc/.julia/dev/PackageCompilerX/src/PackageCompilerX.jl:275
[7] (::PackageCompilerX.var"#kw##create_sysimage")(::NamedTuple{(:sysimage_path, :project, :incremental, :precompile_execution_file, :precompile_statements_file, :cpu_target, :base_sysimage, :compiled_modules),Tuple{String,String,Bool,Array{String,1},Array{String,1},String,String,Bool}}, ::typeof(create_sysimage), ::Symbol) at ./none:0
[8] (::PackageCompilerX.var"#7#8"{Array{String,1},Array{String,1},Bool,Bool,String,String})() at /Users/gnimuc/.julia/dev/PackageCompilerX/src/PackageCompilerX.jl:463
[9] cd(::PackageCompilerX.var"#7#8"{Array{String,1},Array{String,1},Bool,Bool,String,String}, ::String) at ./file.jl:104
[10] #create_app#6(::Array{String,1}, ::Array{String,1}, ::Bool, ::Bool, ::Bool, ::Bool, ::typeof(create_app), ::String, ::String) at /Users/gnimuc/.julia/dev/PackageCompilerX/src/PackageCompilerX.jl:452
[11] create_app(::String, ::String) at /Users/gnimuc/.julia/dev/PackageCompilerX/src/PackageCompilerX.jl:424
[12] top-level scope at REPL[3]:1
I guess this is not supposed to happen since CImGui.jl has already switched to the new artifacts build system and hence there shouldn't be any re-locatability issues described here. |
Fixing JuliaLang/PackageCompilerX.jl#68 might help this. I will try it out today. |
Ok with JuliaLang/PackageCompilerX.jl#71 creating the app works well. However, it immediately exits when started. Perhaps nothing is waiting for the UI task? |
Actually, it is a bug in PackageCompilerX. |
This is all fantastic. Thanks!! |
I gave this a go on my system but the app window still immediately closes when runing |
@KristofferC I hit #15 (comment) again after you force-pushed JuliaLang/PackageCompilerX.jl#71. |
The log showing:
maks me think that it is not running the version in the PR. It should never run |
indeed, I forgot to change the branch 🤦♂ . now I get:
|
Are you on 1.3.1? That is required for PackageCompilerX. |
no. 🤦♂ BB2 has some problems with 1.3.1 so I'm still using 1.3.0. |
Okay, there are some bugfixes in 1.3.1 that are needed, unfortunately (in this case JuliaLang/julia#34062) |
With the latest JuliaLang/PackageCompilerX.jl#71, I can compile it successfully, but it immediately exits even with
|
OK, it's working(both |
Yeah, something has to
I cannot repro... Strange (I'm on Linux now, my prev screenshot was mac) |
I got the graphics bug too now... |
😂 Only on macOS? I moved some source code out of the App folder on Redux.jl's master. Could that be the reason for the bug? |
No on Linux as well. Trying to figure out why... I didn't update Redux so shouldn't be the reason... |
Could it be linked to the speed of execution being faster and GLFW not being ready? I mean it shouldn’t, but the speed of execution is maybe the only difference? |
The precompile file should in theory just speed up the execution by removing some need to compile functions. Maybe the DearImGui guys have some idea what would cause problems like this... |
For posterity, #16 didn't change anything when it comes to the graphics bugs. |
Confirmed this is a CImGui issue. It turns out the naive OpenGL/GLFW example in this branch works well with PackageCompilerX. |
I'm afraid it's still immediately closing for me:
|
With https://github.com/Gnimuc/Redux.jl/pull/5/files#diff-3273ac476f7170cd30f851d83be23287R28 it shouldn't. Did you update the Redux branch to that? |
Also, when I manually close the window I get:
|
doesn't seem right, and when I revert those lines it stays open and closes correctly.. I've lost track of what change actually fixed the window not staying open.. |
@KristofferC @ianshmean the graphic bug should be fixed now, see https://github.com/Gnimuc/Redux.jl/tree/master/examples/App. |
Fixed for me on Ubuntu. This is great! Thanks so much |
That should be fixed by this commit, please try the latest Redux.jl's master again. BTW, I also released a precompiled-binary for macOS here. |
I can not reproduce... Do you get the same result when running https://github.com/Gnimuc/Redux.jl/blob/master/examples/todomvc/app.jl directly? |
@KristofferC I still cannot reproduce, could you give this Gnimuc/Redux.jl#8 a try? |
If I change the window size for CimGui in the render loop to be half of the display sizes: CImGui.SetNextWindowSize((div(display_w, 2), div(display_h, 2))) in the render loop, it works perfectly: My guess is that it has something to do with DPI and scale factors, e.g as described in https://docs.rs/winit/0.21.0/winit/dpi/index.html#how-is-the-scale-factor-calculated:
That is why I tried to divide by two since I thought maybe there is some disagreement somewhere if things are measured in pixels with or without scale factor taken into account. |
Thanks for the info! I now can reproduce the issue on a retina display. I've pushed a new fix on Gnimuc/Redux.jl#8. |
Yep, works perfect with the PR! Thanks :) |
I have a package that uses CImGui that I'd like to compile down to a sysimage, so I've been trying out PackageCompilerX, but it's having difficulties with CImGui, so I've given compiling CImGui alone a go.
I have the scripts setup to load the demo at
examples/demo.jl
, which I manually interact with once loaded, to allow PackageCompilerX to generate the precompile statements. https://github.com/ianshmean/CImGui.jl/tree/attempt_compile/dev/compilationThe process succeeds but with various precompile statement execution failures.
The sysmimage however does begin to work, but the resulting window has graphical bugs.
i.e.
when it should look like
I assume this hasn't been tried before, given how new PackageCompilerX is, but I was wondering if anyone has any ideas? @Gnimuc @KristofferC ?
The text was updated successfully, but these errors were encountered: