# Problems with libGL libraries and ROOT - swrast driver

**URL:** <https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496>\
**Category:** ROOT\
**Created:** [June 22, 2018, 1:56pm UTC](https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496 "2018-06-22T13:56:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![guido.fantini](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@guido.fantini](https://root-forum.cern.ch/u/guido.fantini)\
**Post date:** [June 22, 2018, 1:56pm UTC](https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496/1 "2018-06-22T13:56:51Z")

</div>

Hi all,

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

```auto
void Draw(string inputFile)
{
  TFile* pf = new TFile(inputFile.c_str(),"READ");
  TH3D* h = (TH3D*)pf->Get("CUORE");                                                                
  gStyle->SetCanvasPreferGL(kTRUE);
  h->Draw("glcolz");
}

```

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

`ssh -XY <myusername>@cuore-login.lngs.infn.it`

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

```auto
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!  
Cheers  
Guido

* * *

_ROOT Version:_ Not Provided  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [June 22, 2018, 2:12pm UTC](https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496/2 "2018-06-22T14:12:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [June 22, 2018, 2:28pm UTC](https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496/3 "2018-06-22T14:28:00Z")

</div>

[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](https://root-forum.cern.ch/t/sl-6-x-slc-6-x-centos-6-x-rhel-6-x/15248)

See also:  
[CMSPublic -\> OpenGL and X11 problems](https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookFireworksHowToFix#OpenGL_and_X11_problems)

---

<div class="post-metadata">

**Author:** ![guido.fantini](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@guido.fantini](https://root-forum.cern.ch/u/guido.fantini)\
**Post date:** [June 25, 2018, 7:54am UTC](https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496/4 "2018-06-25T07:54:51Z")

</div>

Ok, then:

1. openGL is installed (I don’t know if properly or not…) on the server, because

```auto
[gfantini@cuore-login1 gfantini]$ ls /usr/lib64 | grep libGL
libGL.so
libGL.so.1
libGL.so.1.2.0
libGLU.so
libGLU.so.1
libGLU.so.1.3.1
libGLw.so
libGLw.so.1
libGLw.so.1.0.0

```

but if I try glxgears, even after having set

`[bash]$ export LIBGL_ALWAYS_INDIRECT=1`

I get this:

```auto
[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  
[https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookFireworksHowToFix#OpenGL\_and\_X11\_problems](https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookFireworksHowToFix#OpenGL_and_X11_problems)  
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  
`gSystem->Load("libGL");`  
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.

Best  
Guido

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [June 25, 2018, 9:08am UTC](https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496/5 "2018-06-25T09:08:58Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![guido.fantini](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/34f0e0/32.png) [@guido.fantini](https://root-forum.cern.ch/u/guido.fantini)\
**Post date:** [June 25, 2018, 9:55am UTC](https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496/6 "2018-06-25T09:55:54Z")

</div>

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!  
Cheers!

Guido

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [July 9, 2018, 9:55am UTC](https://root-forum.cern.ch/t/problems-with-libgl-libraries-and-root-swrast-driver/29496/7 "2018-07-09T09:55:56Z")

</div>

Closed on July 9, 2018, 9:55am UTC

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