Resolved: Plot() issue in REPL w/ GR & Qt - Linux Arch

Stumbled on issue earlier today where Plot() failed in REPL using Linux Manjaro/Arch system, but could plot via a Jupyter notebook.
Saw this issue in a number of places while searching for resolution, so thought would share the simple fix (that works for now, while qt4 is still avail for Arch).

$ sudo pacman -Su qt4

error I was seeing before installing qt4:

julia> p = plot(1:10, rand(10))                                           
/home/e/.julia/packages/GR/f1Iqi/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application
Did you start 'gksqt'?

GKS: Open failed in routine OPEN_WS

There is this announcement for dropping qt4 support from Arch, so concerned a bit for the future…
https://lists.archlinux.org/pipermail/arch-dev-public/2019-April/029560.html
Github issue for this:
https://github.com/jheinen/GR.jl/issues/160
These all seem related: GKS: Open failed in routine OPEN_WS GKS · Issue #172 · jheinen/GR.jl · GitHub, https://github.com/jheinen/GR.jl/issues/111 and https://github.com/JuliaPlots/Plots.jl/issues/1649 (saw that error as well).

Thanks!

The latest GR distribution for ArchLinux is built against Qt5 (https://gr-framework.org/downloads/gr-latest-ArchLinux-x86_64.tar.gz). Could you please try the GR master branch:

ENV["GRDIR"]=""
] add GR#master
] build GR

Thank you for your reply and attention to this matter, and all your work on the GR backend.
First, I uninstalled qt4:

sudo pacman -Rs qt4

then updated the qt5 package to ensure that was ok:

sudo pacman -Su qt5

then validated that Plots was now broken again in the REPL:

/home/e/.julia/packages/GR/f1Iqi/src/../deps/gr/bin/gksqt: error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory
connect: Connection refused
GKS: can't connect to GKS socket application
Did you start 'gksqt'?

GKS: Open failed in routine OPEN_WS
GKS: GKS not in proper state. GKS must be either in the state WSOP or WSAC in routine ACTIVATE_WS
...
julia> p=Plots.plot(1:11, df)                                                                            
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine FILLAREA
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine FILLAREA
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
GKS: GKS not in proper state. GKS must be either in the state WSAC or SGOP in routine POLYLINE
...

Next, from within Julia REPL, followed your instructions (cd to /home dir first). GR built just fine.
Restarted the REPL and as a test:

using Plots ; gr()
data = rand(12)
p=Plots.plot(1:12, data)

Works perfectly!! :+1:

Question: regarding the link you provided to the downloads. I pulled that down and unpacked the file. There isn’t a PKGBUILD file, but rather the four directories (bin, fonts, include, lib). Didn’t go further with that, but would the next step to install the c-libraries be to create an actual package? (if needed, clearly not for current purpose as plots from Julia is working as expected now). It seems the most recent version of GR on the Arch AUR is here, which is v0.18 from 2016: https://aur.archlinux.org/packages/gr-git/
I’ve never created a PKGBUILD file before (and don’t have the desire to do so now), but am just curious if that’s what would be done next (using the v0.18 as a reference) if one were so inclined.
Thanks again!! :smile: