libGL error persists, and I've tried everything
Afficher commentaires plus anciens
and I mean I've tried EVERYTHING.
I try starting matlab (2015a, 2014b did the same), and I get this:
$ matlab
libGL error: unable to load driver: radeonsi_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: radeonsi
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 154 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 36
Current serial number in output stream: 39
MATLAB is selecting SOFTWARE OPENGL rendering.
From within matlab, I get only software openGL:
>> opengl info
Version: '2.1 Mesa 7.2'
Vendor: 'Brian Paul'
Renderer: 'Mesa X11'
MaxTextureSize: 2048
Visual: 'Visual 0x9a, (RGBA 32 bits (8 8 8 8), Z depth 16 bits, Hardware acceleration, Double buffer, Antialias 0 samples)'
Software: 'true'
SupportsGraphicsSmoothing: 0
SupportsDepthPeelTransparency: 1
SupportsAlignVertexCenters: 0
Extensions: {114x1 cell}
MaxFrameBufferSize: 4096
I'm not the first to get this, and I've tried every fix I can think of and duckduckgo can find.
- Firstly, I've assumed that it was a problem with my installation and/or graphics drivers and/or card. See https://forums.gentoo.org/viewtopic-t-1012914.html for some of the other things I've tried, including recompiling my entire system a dozen times, I've tried hardened and non-hardened kernels. I've tried both official and open-source graphics drivers, I've even bought a new card to see if the other was faulty. I've tried different versions / releases, I've tried git sources of latest releases. I've chased down problems in mesa, in X, in KDE, tried wayland and gles to see if they help.
Nothing.
Absolutely no difference.
- So I've tried other things, like linking libGL in the matlab directory to my system libGL from the official support-team answer here: https://www.mathworks.com/matlabcentral/answers/94805-why-does-my-linux-hardware-opengl-not-work-properly. To start, I did as written and linked just the libGL and not the libGLU:
/usr/local/MATLAB/R2015a/sys/opengl/lib/glnxa64 $ ls -l
lrwxrwxrwx 1 rjs rjs 19 Sep 9 10:30 foolibGL.so.1 -> libGL.so.1.5.070200 % (these were copied so I didn't lose them)
-r-xr-xr-x 1 rjs rjs 3200281 Dec 29 2014 foolibGL.so.1.5.070200 % (these were copied so I didn't lose them)
-r--r--r-- 1 rjs rjs 1377 Dec 29 2014 libGL.rights
lrwxrwxrwx 1 rjs rjs 23 Sep 9 13:59 libGL.so.1 -> /usr/lib/libGL.so.1.2.0
lrwxrwxrwx 1 rjs rjs 23 Sep 9 13:58 libGL.so.1.5.070200 -> /usr/lib/libGL.so.1.2.0
-r--r--r-- 1 rjs rjs 1780 Dec 29 2014 libGLU.rights
lrwxrwxrwx 1 rjs rjs 20 Sep 9 10:29 libGLU.so.1 -> libGLU.so.1.3.070200
-r-xr-xr-x 1 rjs rjs 630382 Dec 29 2014 libGLU.so.1.3.070200
-r--r--r-- 1 rjs rjs 1319 Dec 29 2014 libMesa.rights
No change.
- I've tried linking the libGLU in the matlab path to my system libGLU as well, that also doesn't work. Actually, it makes it worse, both methods start the same but linking the libGL and not the libGLU gives me errors within matlab whenever I try to plot a graph:
javax.media.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for :0
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:317)
at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:295)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.media.opengl.GLException: Startup Class Loader-SharedResourceRunner: Error making temp context(1) current: display 0x7f7de0000e10, context 0x7f7de00bd060, drawable X11OnscreenGLXDrawable[Realized true,
Factory jogamp.opengl.x11.glx.X11GLXDrawableFactory@a17b90b,
and a whole lot of other debug crap I can post if anyone thinks it's useful. Leaving libGL and libGLU both as default to use the matlab-supplied versions actually results in the least errors.
- I've tried linking my radeon drivers into various directories:
/usr/local/MATLAB/R2015a $ ls */*/*dri* -l
lrwxrwxrwx 1 rjs rjs 29 Sep 9 09:53 bin/glnxa64/radeon_dri.so -> /usr/lib/mesa/radeonsi_dri.so
lrwxrwxrwx 1 rjs rjs 31 Sep 9 09:53 bin/glnxa64/swrast_dri.so -> /usr/lib/mesa/kms_swrast_dri.so
-r--r--r-- 1 rjs rjs 23551 Feb 3 2015 help/compiler/deploying-a-standalone-application-on-a-network-drive-windows-only.html
lrwxrwxrwx 1 rjs rjs 29 Sep 9 09:46 runtime/glnxa64/radeonsi_dri.so -> /usr/lib/mesa/radeonsi_dri.so
lrwxrwxrwx 1 rjs rjs 31 Sep 9 09:52 runtime/glnxa64/swrast_dri.so -> /usr/lib/mesa/kms_swrast_dri.so
/usr/local/MATLAB/R2015a $ ls */*/*/*dri* -l
lrwxrwxrwx 1 rjs rjs 29 Sep 9 09:56 bin/glnxa64/graphicssystems/radeon_dri.so -> /usr/lib/mesa/radeonsi_dri.so
lrwxrwxrwx 1 rjs rjs 31 Sep 9 09:56 bin/glnxa64/graphicssystems/swrast_dri.so -> /usr/lib/mesa/kms_swrast_dri.so
lrwxrwxrwx 1 rjs rjs 29 Sep 9 09:50 sys/os/glnxa64/radeon_dri.so -> /usr/lib/mesa/radeonsi_dri.so
lrwxrwxrwx 1 rjs rjs 29 May 26 13:20 sys/os/glnxa64/radeonsi_dri.so -> /usr/lib/mesa/radeonsi_dri.so
lrwxrwxrwx 1 rjs rjs 31 Sep 9 09:51 sys/os/glnxa64/swrast_dri.so -> /usr/lib/mesa/kms_swrast_dri.so
lrwxrwxrwx 1 rjs rjs 28 May 26 13:20 sys/os/glnxa64/swrastg_dri.so -> /usr/lib/mesa/swrastg_dri.so
and so forth. Again, no difference.
- I've also read that it can be a missing libstdc++ problem. For a start, my matlab or whatever toolboxes I've got installed a libstdc++ for me, so I didn't need to link to my system libstdc++. But I tried it anyway:
/usr/local/MATLAB/R2015a/sys/os/glnxa64 $ ls -l *stdc*
lrwxrwxrwx 1 rjs rjs 21 May 26 13:44 foolibstdc++.so.6 -> ./libstdc++.so.6.0.17 % (again, just so I don't lose them)
-r-xr-xr-x 1 rjs rjs 6345639 Dec 29 2014 foolibstdc++.so.6.0.17 % (again, just so I don't lose them)
lrwxrwxrwx 1 rjs rjs 27 Sep 9 15:00 libstdc++.so -> /usr/lib/libstdc++.so.5.0.7
lrwxrwxrwx 1 rjs rjs 27 Sep 9 15:00 libstdc++.so.5 -> /usr/lib/libstdc++.so.5.0.7
lrwxrwxrwx 1 rjs rjs 27 Sep 9 15:00 libstdc++.so.5.0 -> /usr/lib/libstdc++.so.5.0.7
lrwxrwxrwx 1 rjs rjs 27 Sep 9 15:00 libstdc++.so.5.0.7 -> /usr/lib/libstdc++.so.5.0.7
lrwxrwxrwx 1 rjs rjs 27 Sep 9 15:01 libstdc++.so.6 -> /usr/lib/libstdc++.so.5.0.7
lrwxrwxrwx 1 rjs rjs 27 Sep 9 15:01 libstdc++.so.6.0 -> /usr/lib/libstdc++.so.5.0.7
lrwxrwxrwx 1 rjs rjs 27 Sep 9 15:01 libstdc++.so.6.0.17 -> /usr/lib/libstdc++.so.5.0.7
That opens up a whole lot of new errors on startup, along the lines of:
$ matlab
/usr/local/MATLAB/R2015a/bin/glnxa64/need_softwareopengl: /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /usr/local/MATLAB/R2015a/bin/glnxa64/need_softwareopengl)
/usr/local/MATLAB/R2015a/bin/glnxa64/need_softwareopengl: /usr/local/MATLAB/R2015a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/local/MATLAB/R2015a/bin/glnxa64/need_softwareopengl)
and about 100 more. So I'm not even going to try to link every single one of those to my system libraries.
- Finally, I've also tried changing my LD_LIBRARY_PATH from within matlab to just point to my /lib and /usr/lib first: setenv('LD_LIBRARY_PATH','/lib:/usr/lib:/usr/local/MATL<snip>') % The rest as copied from getenv.
And that won't even hold a value, when I setenv it, quit and restart matlab, getenv is as before, with no /lib nor /usr/lib values.
So, I can't think of anything else. There really is no way, it seems, to get any sort of openGL working on this system through any fix that someone's had before. Anyone know anything else to try, what more info is needed, etc?
12 commentaires
Walter Roberson
le 9 Sep 2015
Environment variables are never permanent: they are properties of running processes. You can set the environment variable in your shell startup, or in the matlab script.
Anders Kirchenbauer
le 20 Sep 2015
Modern MESA FOSS drivers on Linux distros allow hardware OpenGL acceleration. To use this appropriately you must delete the files that are preventing your graphics resources from loading because they are overriding the system libraries that were used to compile the graphics drivers.
To do so, go to your Matlab directory and run:
rm `find -name libstdc++\*`
This will delete them from that directory and allow HW Acceleration. From there you must enter the program itself and type:
opengl('save','hardware')
Then restart MatLab and you should be ready to go with HW Acceleration provided by the FOSS drivers. This is also necessary to support modern Intel and modern Nouveau NVidia drivers.
Adam
le 30 Déc 2015
Anders: Thank you for your comment. I had a similar problem to the OP's, and your comment solved it for me.
J-Donald Tournier
le 15 Jan 2016
Just thought I'd add this worked for me too (Matlab R2015b, Arch Linux, Nouveau drivers). Thanks for the fix!
David
le 6 Avr 2016
Thank you Anders! That helped (R2015a, Ubuntu 16.04, Nouveau drivers)
Abhrajit
le 16 Avr 2016
Dear @a1077793,
I had similar problem. I have managed to iron out from a suggesation from this link. First I have gone to sys/os/glnxa64 under matlab and then do two thing.
mv libgcc_s.so.1 libgcc_s.so.1.bak
mv libstdc++.so libstdc++.so.bak
mv libstdc++.so.6 libstdc++.so.6.bak
mv libstdc++.so.6.** libstdc++.so.6.**.bak
Then, I link the system files by
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.20 libstdc++.so
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
which was suggested by some, and may require for few cases. But error was still there. Then I removed
mv libgcc_s.so.1 libgcc_s.so.1.bak
This last command eventually get my work done. Hopefully it will be of some use for people who are using Radeon graphics.
Ruben Salvador
le 5 Mai 2016
I confirm @Abhrajit last bit: renaming/removing libgcc_s.so.1 is in fact also needed to get openGL hardware acceleration running in Matlab R2016a under Debian Stretch 64 bits with a Radeon card using the free graphics drivers.
Thank you all guys!
João Marcos Scaramal
le 7 Oct 2016
I can also confirm @Abhrajit solution. Worked like a charm. Arch Linux + R2015a
Rodrigo Medina
le 18 Jan 2017
I can also confirm @Abhrajit solution. Work great with my Debian distro and Matlab 2015a.
Sebastian Bahamonde
le 10 Mar 2017
@Abhrajit solutionm worked! Thanks a lot. Ubuntu 16.04, MatlabR2014b
Aaron Anderson
le 3 Mai 2017
Modifié(e) : Aaron Anderson
le 3 Mai 2017
I now have hardware openGL working with -nosoftwareopengl tag after renaming the two symbolic links from @Abhrajit. I did not however need to rename the last.
Debian Stretch Matlab 2017a
William Chamberlain
le 21 Oct 2018
Modifié(e) : William Chamberlain
le 21 Oct 2018
For completeness: @Abhrajit's answer worked for me, with Matlab 2016a on Ubuntu 14.04
In my case: in Matlab
>> matlabroot % check which directory I need to update from the Ubuntu command line
ans =
/mnt/nixbig/downloads/matlab_R2016a
in the Ubuntu command line
cd /mnt/nixbig/downloads/matlab_R2016a/
ls -l | grep libsrdc # to check the versions I have
mv libgcc_s.so.1 libgcc_s.so.1.bak
mv libstdc++.so.6 libstdc++.so.6.bak
mv libstdc++.so.6.0.17 libstdc++.so.6.0.17.bak
ls /usr/lib/x86_64-linux-gnu/ | grep libstdc # to check the versions I have
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22 libstdc++.so
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
Réponses (3)
Willi Mutschler
le 12 Avr 2020
Hi,
I am on Ubuntu 20.04 beta and running the nvidia on-demand prime profile, and get the same error. I can solve this (see the Archwiki) by starting matlab from terminal:
export MESA_LOADER_DRIVER_OVERRIDE=i965; matlab
Or (additionaly) you can change the EXEC in /usr/share/applications/matlab.desktop to:
Exec=env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop
2 commentaires
Mustafa Oguzhan Akdogan
le 26 Oct 2023
I believe this fix does not belong here. This fix applies to Nvidia gpus.
Willi Mutschler
le 26 Avr 2020
2 votes
I also ran into this issue on my Dell XPS 13 9360 which neither has a NVIDIA or AMD card, but an on-board intel graphics card.
I filed a bug report with MATHWORKS and they proposed two solutions:
- Create a file with the name 'java.opts' in the directory where MATLAB is executed (for me this is in '/usr/local/MATLAB/R2020a/bin/glnxa64') with the following line: -Djogl.disable.openglarbcontext=1
- If this does not work, then the above solution using export MESA_LOADER_DRIVER_OVERRIDE=i965 is working.
For me both solve my issue.
1 commentaire
Leonardo Ghizoni
le 18 Nov 2022
Awesome! The first solutions worked for me as well :-) I'm using Debian 11 with intel graphics. Thanks for the post!
Redouane Boudjemaa
le 29 Mai 2017
1 vote
Thanks https://www.mathworks.com/matlabcentral/profile/authors/3509132-abhrajit for the answer, it did work for me too Matlab 2017a Ubuntu 16.04 64bits
1 commentaire
Curt Corum
le 21 Oct 2017
The following removed the error/warning for R2017b on Ubuntu 16.04 LTS:
/usr/local/MATLAB/R2017b/sys/os/glnxa64
libstdc++.so -> libstdc++.so.6
libstdc++.so.6 -> /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6.0.21 -> /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
Catégories
En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!