Ubuntu – Problems with libGl, fbConfigs, swrast through each update

driversnvidiaopenglupdates

I have problems when compile SFML-project(don't see any graphic):

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

This error can be solved by simple reinstalling nvidia-drivers through this tutorial: https://askubuntu.com/a/451248/341889

..but when i get new updates – this error is returning ;( What should I do? It's not the solution – not use system's update…

P.S. and yes, i saved all changes after installing nvidia-drivers

Best Answer

The swrast thing is the software renderer. That means it's not finding the hardware driver for your graphics card. There are a bunch of libGL libraries installed and a bunch of of symbolic links to those libraries. To see these run this from the shell:

find /usr -iname "*libGL.so*" -exec ls -l -- {} + 

Now the probable cause of your problem is that installing graphics drivers sometimes break these symbolic links. (Specifically /usr/local/lib/libGL.so.1.2.0 is likely to be either the wrong lib or a sym link to the wrong link) (N.B. I wrote this a while ago. libGL.so.1.2.0 was the current gl version it may be something else now).

To work out what library the OpenGL programs are trying to run you can turn on a bit of verbosity and run a simple OpenGL program. You can verify this using the standard OpenGL test program:

LIBGL_DEBUG=verbose glxgears

Hopefully that will fail in the same way as SFML. With LIBGL_DEBUG it should tell you what OpenGL library it's trying to load. Furthermore the lib it will be trying to load will almost certainly be /usr/local/lib/libGL.so.1.2.0 (Edit: This was the standard OpenGL library on my machine at the time I answered this. It may well be some other version on your machine now).

So the solution (in this case) is to make sure that /usr/local/lib/libGL.so.1.2.0 is a symbolic link pointing at the right OpenGL library. In my case I have the Nvidia 3.40 driver so I ran:

ln -s /usr/lib/nvidia-340/libGL.so.1 /usr/local/lib/libGL.so.1.2.0

But you'll want to point it at the OpenGL lib that is appropriate for you (listed in the first find command).

In summary: installing (proprietary) graphics drivers can break the symbolic links used for OpenGL libs. To solve this problem manually fix the symbolic links (fix /usr/local/lib/libGL.so.1.2.0 first).