Problems with libGL libraries and ROOT - swrast driver

Hi all,

I am trying to plot a TH3D in root with a very simple macro:

void Draw(string inputFile)
  TFile* pf = new TFile(inputFile.c_str(),"READ");
  TH3D* h = (TH3D*)pf->Get("CUORE");                                                                

but as soon as I run it interactively from an SSH session

ssh -XY <myusername>

I get this weird error. I tried googling that but didn’t get any useful info

root [0] .L CuoreRate3D.C 
root [1] Draw("../out/CuoreRate3D.root");
libGL error: failed to load driver: swrast
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
Error in <RootX11ErrorHandler>: GLXBadContext (XID: 6291743, XREQ: 149)

It looks also someone else on this forum had this kind of issues but when I was going through the other posts I couldn’t really understand what was the problem. Can someone explain me what’s happening?

Thanks a lot!

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

Is OpenGl properly installed on this machine ? can you run some standard app like “glxgears” ? I searched in google: “swrast opengl fail” and got several answers which might help you.

On your “remote computer”, before you start ROOT or another OpenGL (GLX) application (e.g. “glxinfo” and/or “glxgears”), try:
[bash]$ export LIBGL_ALWAYS_INDIRECT=1
[tcsh]$ setenv LIBGL_ALWAYS_INDIRECT 1

See also:
CMSPublic -> OpenGL and X11 problems

Ok, then:

  1. openGL is installed (I don’t know if properly or not…) on the server, because
[gfantini@cuore-login1 gfantini]$ ls /usr/lib64 | grep libGL

but if I try glxgears, even after having set

[bash]$ export LIBGL_ALWAYS_INDIRECT=1

I get this:

[gfantini@cuore-login1 gfantini]$ glxgears
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  21
  Current serial number in output stream:  23

I confess I need to check more carefully into here
but I suspect it could be related to this suggestion (which I have to say I don’t really understand…):

This can be fixed by adding the +iglx option to the line that starts the X server on the local machine. There is currently no configuration file option (it will be added to xorg-1.19 and probably backported to older versions).

What do they mean by “the line that starts the X server on the local machine”?

Anyway, in my root macro I forgot to
and that sent away the first two errors but I still get

Error in <RootX11ErrorHandler>: GLXBadContext (XID: 12583199, XREQ: 149)

Thank you very much for your suggestions. They really speed up my debug process!
And sorry if I ask dumb questions, I am sort of noob about this.


The “local machine” means the computer on which you actually display your graphics (i.e. the computer with the graphics card to which your monitor / screen is directly connected).

Good then!

I think I got the solution. On mac OSX one should just kill the X server (go to activity monitor, look for the xquartz processes and kill them all), then open a shell and give

defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

which would set the -iglx option (whatever it means).
Then restart the ssh -XY session, and run any GL-based application (such as glxgears).

Thank you all for your patience, suggestions and useful help!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.