Problem with surface() when using plots.jl and gr() backend

I’m having a problem with a surface plot, using Plots.jl and the gr() backend. A minimal example is

using Plots
gr()
#plotlyjs()
x = range(0.9, length=100, stop=1.1)
y= range(0.9, length=100, stop=1.1)
p1 = surface(x, y, (x,y)->x+y)

with the plotlyjs() backend, the plot appears as expected, using the REPL, or VS Code. With the gr() backend, I get a crash out of julia, with the following message:

julia> include("MWE.jl")
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: iris
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
X Error:  BadMatch
  Request Major code 152 (GLX)
  Request Minor code 26 ()
  Error Serial #45
  Current Serial #45
❯ 

I am using Julia v1.7.2, GR v0.64.3, Plots v1.29.0. I recently installed and then removed Nvidia drivers. This is Debian testing. I’m not sure if this is a problem with my Linux installation, or with GR.

your example works on Win10, Julia 1.8.0-beta3

A solution I found in another discourse thread is to copy the system libstdc++ over the one included with the Julia pre-compiled binary.

cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 julia-1.8.0-beta3/lib/julia/

Could you please try

using GR
x = range(0.9, length=100, stop=1.1)
y= range(0.9, length=100, stop=1.1)
surface(x, y, (x,y)->x+y)

cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 julia-1.8.0-beta3/lib/julia/

But this cp command doesn’t change anything in you Julia v1.7.2 environment!?

Sorry, I have both 1.7.2 and 1.8.0-beta3 installed, and I switched between my messages. The problem occurs with both, and the solution fixes the problem for both. The code using GR directly without Plots has the same problem, and is fixed by copying the library. This is not a GR or Plot issue, I believe. I think (?) it has to do with libraries having been updated on my rolling release Linux (Debian testing). Thanks for GR.jl, love it!

I found the solution here: GLIBCXX_3.4.26 not found in RCall - #10 by laborg