libGL error: failed to load drivers iris and swrast in Ubuntu 20.04

Solution 1:

I just had same issue with Kiwix on Linux Mint and found your question. I was able to solve my issue reading: https://github.com/kiwix/kiwix-desktop/issues/393. The issue I understood is that iris driver is configured on Ubuntu to be used by default on laptops whereas in my case on my old laptop graphic card supports older driver. So the solution/workaround is to set environmental variable before running the app in command prompt, like this:

MESA_LOADER_DRIVER_OVERRIDE=i965 ./kiwix-deskop

Hope that helps you too.

P.S. in case you want to try to set this variable permanently and nothing else breaks, see: How to permanently set an environment variable

Solution 2:

I ran into a similar problem when trying to run a python app in a virtual environment (anaconda3). It turned out that the library libstdc++.so used by the virtual env was different from the one used by the OS.

I needed first to find out the full paths to libraries involved:

DISPLAY=:0 LIBGL_DEBUG=verbose python test.py

This gave me a hint that the libstdc++.so.6 used here might be different from the one used by OS:

libGL: MESA-LOADER: failed to open /usr/lib/x86_64-linux-gnu/dri/i965_dri.so: /home/fairfax/anaconda3/envs/py3/bin/../lib/libstdc++.so.6
: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/dri/i965_dri.so)

Then I checked out the library used by the virtual env:

strings /home/fairfax/anaconda3/envs/py3/bin/../lib/libstdc++.so.6 | grep CXXABI

To find out that the flag CXXABI_1.3.8 was indeed missing. I was able to fix this by overwriting the virtual env version with the system version of libstdc++.so.6 and redirecting all symbolic links to the new version:

$~/anaconda3/envs/py3/lib$ ls -al | grep libstdc++     
 lrwxrwxrwx  1 fairfax fairfax       19 lis  1 08:55 libstdc++.so -> libstdc++.so.6.0.25                                                
lrwxrwxrwx  1 fairfax fairfax       19 lis  1 08:55 libstdc++.so.6 -> libstdc++.so.6.0.25                                              
-rw-r--r--  1 fairfax fairfax  1594864 říj 29 16:27 libstdc++.so.6.0.25