Matlab: libGL error: dlopen /usr/lib64/dri/swrast_dri.so failed

By: | Comments: No Comments

Posted in categories: Computer Tips, Work related

Starting Matlab R2015a or newer in CentOS7 or recent version of Fedora, the error
libGL error: dlopen /usr/lib64/dri/swrast_dri.so failed
will rise through does not affect the normal working of Matlab.

This problem is caused by the libstdc++.so.6 coming with Matlab.

Matlab carries statically linked libstdc++.so.6.0.17 in /matlab_folder/sys/os/glnxa64. When the system version of libstdc++.so.6 is lower than the Matlab carried version, Matlab will run without rising any errors. If your system’s libstdc++.so.6 version is higher than the matlab version, you will see the above error.

The cure is to use link to your system version of libstdc++.so.6 instead of the link to libstdc++.so.6.0.17 in /matlab_folder/sys/os/glnxa64.

For example, if in CentOS7, you can do
rm -f /matlab_folder/sys/os/glnxa64/libstdc++.so.6
ln -s /usr/lib/libstdc++.so.6.0.19 /matlab_folder/sys/os/glnxa64/libstdc++.so.6
and matlab will work without this error.

Be the first to comment!

Leave a Reply