When launching matlab I get the following error: MESA-LOADER: failed to open iris:

Hi,
I can see many similar problems have been reported,but unfortunately I din't find the answer.
When I launch Matlab I get the following message:
MATLAB is selecting SOFTWARE OPENGL rendering.
MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: iris
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver
Gtk-Message: Failed to load module "canberra-gtk-module"
I use Matlab R2021b, Ubuntu 20.04.3 LTS with graphics Mesa Intel® UHD Graphics (TGL GT1).
I can find e.g. iris_dri.so in /usr/lib/x86_64-linux-gnu/dri/iris_dri.so
and /snap/gnome-3-38-2004/87/usr/lib/x86_64-linux-gnu/dri/iris_dri.so
What should I change so that Matlab would find that path?
Thanks a lot in advance for your answers,
Kaisa

4 Comments

Hi, the same problem!!!
creo que se soluciono con esto:
-----------------------------------------------------------------------------------------------------------------
cd /mnt/sda1/programas/matlab/programa_instalado/bin/glnxa64/../../sys/os/glnxa64/
mv libstdc++.so.6 libstdc++.so.6.old
ln -s /usr/lib/libstdc++.so.6 libstdc++.so.6
-Djogl.disable.openglarbcontext=true

Sign in to comment.

 Accepted Answer

Same problem with MATLAB version 2022a. I was able to solve it on my system by doing two things:
  1. In directory ~/MATLAB/R2022a/sys/os/glnxa64, I unlinked libstdc++.so.6 and made a new soft link to the system version of libstdc++.so.6:
unlink libstdc++.so.6
ln -s /lib64/libstdc++.so.6
2. Following the advice of Mark Debord, I created the file java.opts in my home directory with the single line:
-Djogl.disable.openglarbcontext=1
Starting matlab from my home directory, opengl worked normally. Hope this helps others. Of course other distributions may keep libstdc++ in a different place so you may need to find that location.

23 Comments

Thanks, this just worked for me with R2021b on Ubuntu 21.10
Thank you very much, also worked for me with R2020b on Arch Linux. Do you know what caused the problem?
I think it is a mismatch between the libstdc++ shipped with matlab and the versions present in more current distributions. They are probably based on different versions of libc/glibc.
Thanks!
That (almost) worked for me as well.
Ubuntu 22.04 on very old iMac 21".
The MESA-LOADER messages are gone but new Java messages appear in the Matlab command window.
In which directory shoud be saved that java.opts file?
Thanks again
Finally my solution was another simple one, following the suggested in askubuntu.com
Open Matlab with the command:
matlab --softwareopengl
Then, at the command prompt inside Matlab run the command:
opengl('save','software')
this does not help with matlab 2022a here:
Warning: Unrecognized command line option: -softwareopengl.
Thanks a lot!
This solved all other error messages except the "Gtk-Message: 10:14:47.373: Failed to load module "canberra-gtk-module"
-Djogl.disable.openglarbcontext=1 doesn´t work (commando not found)
-Djogl.disable.openglarbcontext=1 is not a command. It must be the contents of a java.opts file which is in the directory where you start matlab.
Amazing! Confirms that this works with MATLAB R2023a / Simulink, on Ubuntu 22.04.
Great, confirmed this works on R2023a on debian 12 Bookworm
The main answer worked for me! 22.04 Ubuntu. Thanks
thanks! it works for me! Ubuntu 22.04, matlab R2023a :)
um... my os(ubuntu23.10) was crashed after executed
unlink libstdc++.so.6
when I restart ubuntu 23.10, there are too many kinds of errors show
localhost thermald 814 /usr/sbin/thermald: /lib64/libstdc++.so.6 version 'GLIBCXX_3.4.32' not found (required by /usr/sbin/thermald)
also apt was dead.
I use matlab 2023b. orz
Sounds like you did the unlink in the system directory. You should only do this in the xxx/MATLAB/Ryyyy/sys/os/glnxa64 directory.
To fix your system you must re-link libstdc++.so.6 in /lib64 (or where ever it is located on your system) to something like libstdc++.so.6.i.j where you find i and j by "ls -l libstdc++*" in the correct directory.
Hope this helps.
This works perfectly on my Devuan (Debian 6.1.99-1 AMD64). Thanks so much for this great advice.
cd /usr/local/MATLAB/R2024a/sys/os/glnx64
sudo unlink libstdc++.so.6
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6
vim ~/java.opts
-Djogl.disable.openglarbcontext=1
Glad it worked for you. To get around the restriction of opening MATLAB in my home folder, I created a small shell script in my $PATH:
currentDir=$PWD
cd $HOME
matlab -r "cd ${currentDir}"
I called it mlstart and set execute permission:
chmod u+x mlstart
and then I can start MATLAB from any directory and still have proper graphics.

Sign in to comment.

More Answers (2)

I did not try this solution but I have found another at Stackoverflow for Intel CPU: add environment variable
export MESA_LOADER_DRIVER_OVERRIDE=i965
It works on Ubuntu 22.04.1
I have the same setup, and I got the same error now. Unfortunately I couldn't find a solution, but I can still use matlab with "matlab -nodesktop" command, since it is related to graphics driver or something. The strange thing is I didn't update any driver or any opengl related thing, this thing came like in all of a sudden.

Categories

Products

Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!