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

Wayland backend not working in Plots.jl GR backend #141

Closed
VarLad opened this issue Aug 25, 2021 · 16 comments
Closed

Wayland backend not working in Plots.jl GR backend #141

VarLad opened this issue Aug 25, 2021 · 16 comments

Comments

@VarLad
Copy link

VarLad commented Aug 25, 2021

In Julia 1.7.0beta3, Plots v1.20.1, GR.jl v0.58.1
I realized that the default (GR) backend uses XWayland for the plotting window
Anyway I can use Wayland instead?
I usually get:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

After doing
ENV["QT_QPA_PLATFORM"]="wayland" in Julia, or starting julia with QT_QPA_PLATFORM=wayland julia
I get the same error, the error being,

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, vnc, xcb.

connect: Connection refused
GKS: can't connect to GKS socket application
@VarLad VarLad changed the title Wayland backend not working in Plots GR backend Wayland backend not working in Plots.jl GR backend Aug 25, 2021
@IngoMeyer441
Copy link
Member

Hey @VarLad, thanks for reporting this issue. I can reproduce this behavior on Ubuntu 20.04 with Wayland enabled.

GR itself does not depend on X when the Qt output driver is used. I looked at the ~/.julia/artifacts directory and there is no Qt plugin for wayland. Probably, the Qt5Base_jll package needs to be changed to include the wayland output plugin.

@VarLad
Copy link
Author

VarLad commented Aug 25, 2021

@barche any idea?

@VarLad
Copy link
Author

VarLad commented Aug 25, 2021

After some searching around, I think, to achieve a wayland backend, we'll have to build Qt5Base_jll with https://github.com/qt/qtwayland

I've no idea how viable that is though! 😅

@mkitti
Copy link
Contributor

mkitti commented Aug 25, 2021

If you do ENV["JULIA_GR_PROVIDER"] = "GR" and then using Pkg; Pkg.build("GR"), do you have the same issue? This will get the sciapp tarball rather than the BinaryBuilder.org one

cc: @jheinen

@VarLad
Copy link
Author

VarLad commented Aug 25, 2021

@mkitti Thanks! Correct, that uses the Wayland version!

@mkitti
Copy link
Contributor

mkitti commented Aug 25, 2021

Great, so we have a workaround.

You may want to file an issue on this build script then:
https://github.com/JuliaPackaging/Yggdrasil/blob/master/Q/Qt5Base/build_tarballs.jl

@wheeheee
Copy link

I'm seeing this again on GR.jl v0.69.5 at least. The workaround doesn't seem to work anymore :(

@ggebbie
Copy link

ggebbie commented Oct 31, 2022

I confirm that the workaround is not working for me on:
ubuntu 22.04, Plots v1.35.6, GR v0.69.5, julia 1.8.2

it did work with: Plots v1.33.0, GR v0.66.2, julia 1.8.2

@jheinen
Copy link
Collaborator

jheinen commented Nov 1, 2022

The GR binaries thing has never been established in the Julia community, unfortunately - so all the logic was removed in favor of BinaryBuilder. The origin of the problem is that Wayland is not compiled into the Qt5Base_jll BinaryBuilder binaries.

@mkitti
Copy link
Contributor

mkitti commented Nov 1, 2022

Err... time for me to review the recent changes.

@mkitti
Copy link
Contributor

mkitti commented Nov 1, 2022

Looks like we removed support as GR.jl v0.68.0:

jheinen/GR.jl#465

@mkitti
Copy link
Contributor

mkitti commented Nov 1, 2022

jheinen/GR.jl#471 may provide an alternate work around.

@t-bltg could you help me formulate what a new work around might be?

Loosely,

  1. One would need to download the appropriate tarball from https://github.com/sciapp/gr/releases
  2. Extract the tarball
  3. Execute the following.
using GR
GR.GRPreferences.use_system_binary("/path/to/extracted/gr/tarball")

Frankly, I think we could probably recover the build script, but just integrate this with the new Preferences.jl mechanism:
https://github.com/jheinen/GR.jl/blob/e7940105f3594e3c8ed0c1d75f846d7358a35b3f/deps/build.jl

@t-bltg
Copy link
Contributor

t-bltg commented Nov 1, 2022

Untested, but looks good.

You can either use GR.GRPreferences.use_system_binary to make the changes persistent, or set the env variable GRDIR to the extracted tarball path before starting julia.

No need to ] build GR, we use dlopen in GR.

@jheinen
Copy link
Collaborator

jheinen commented Nov 1, 2022

At first glance, this seems to work. But under Linux, a simple 3D plot (using GR; surface(peaks())) fails - tests do not run through either.

I had to pre-load most of the GR libraries before starting Julia:

export GRDIR=/usr/local/gr
export LD_PRELOAD="/usr/local/gr/lib/libGR.so /usr/local/gr/lib/libGR3.so /usr/local/gr/lib/libGR3platform.so /usr/local/gr/lib/libGRM.so /usr/local/gr/lib/libGKS.so /usr/local/gr/lib/aggplugin.so /usr/local/gr/lib/cairoplugin.so /usr/local/gr/lib/gsplugin.so /usr/local/gr/lib/pgfplugin.so /usr/local/gr/lib/svgplugin.so /usr/local/gr/lib/videoplugin.so"
julia ...

I'm still trying to understand why the preload mechanism is required.

@t-bltg
Copy link
Contributor

t-bltg commented Nov 1, 2022

Sometimes some segfaults are observed in 3d plots (jheinen/GR.jl#480), what I usually do is re-download and extract the artifacts, quite odd.

@mkitti
Copy link
Contributor

mkitti commented Nov 1, 2022

I created a pull request which restores the build script as a module under GRPreferences: jheinen/GR.jl#483

Mostly this is to restore the download logic.

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

7 participants