Skip to content
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

Can't precompile without a display #219

Open
GlenHertz opened this issue Apr 3, 2023 · 6 comments
Open

Can't precompile without a display #219

GlenHertz opened this issue Apr 3, 2023 · 6 comments

Comments

@GlenHertz
Copy link

I'm using remote VSCode to a remote ssh backend and trying to precompile ProfileView but it fails with:

Failed to precompile ProfileView [c46f51b8-102a-5cf2-8d2c-8597cb0e0da7] to "/home/glenhertz/.julia/compiled/v1.10/ProfileView/jl_Ay2Daz".
ERROR: LoadError: InitError: Cannot open display: 
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] Gtk.GLib.GError(f::Gtk.var"#325#331")
    @ Gtk.GLib ~/.julia/packages/Gtk/oo3cW/src/GLib/gerror.jl:17
  [3] __init__()
    @ Gtk ~/.julia/packages/Gtk/oo3cW/src/Gtk.jl:142
  [4] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1074
  [5] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1020
...

Should ProfileView compile when no display is available?

@timholy
Copy link
Owner

timholy commented Apr 6, 2023

I've wondered about that. But how would you use it without a display?

@timholy
Copy link
Owner

timholy commented Apr 6, 2023

Looking at the stacktrace, the error is thrown from Gtk's __init__ function. So simply having Gtk as a dependency and loading the module seems to cause this.

@AmarnathMurugan
Copy link

I've wondered about that. But how would you use it without a display?

I've SSHed into a cluster from VS Code to use Julia, and get the same error. It is because GTK is checking the number of displays only on the remote node instead of my local device.

@alex-s-gardner
Copy link

This is an issue for myself as well. When using VSCode remote desktop ssh'd into a headless server I'm unable to use ProfileView because of GTK .

@jwahlstrand
Copy link
Collaborator

I think I see a path to get precompiling to not fail (or at least fail silently) without a display, by allowing the call of gtk_init_check in Gtk4's __init__ function to fail, and then in ProfileView.jl (and other downstream packages) checking if initialization succeeded before trying to run Gtk4-related code. But if downstream packages didn't check for initialization they would probably crash during precompilation, and the added complexity might lead to other problems.

Even if precompilation didn't error out on a headless server, GTK-based code isn't going to work through ssh without setting up something like X forwarding. Unless I'm missing something? Can you use VSCode's built-in @profview, which is not based on GTK?

@alex-s-gardner
Copy link

VSCode's built-in @profview does indeed work for my use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants