libGL error unable to load driver in Ubuntu 16.04 while running Matlab R2013b

조회 수: 6 (최근 30일)
I was trying to run a m-file on R2013b in Ubuntu 16.04. But i got the error and Matlab just hung:
libGL error: unable to load driver: r600_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: r600
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
The m-file tries to draw 3D plots of point clouds after reading ply files and processing them. My Matlab IDE completely froze and i had to use xkill to close it as nothing else worked.
The same code works normally in Windows without any extra configuration. By adding breakpoints and running one by one line, i found that the Matlab's plot3() function is giving trouble. I have previously done 2D plots using plot() function and it worked seamlessly in Ubuntu matlab. Both the files r600_dri.so and swrast_dri.so are in /usr/lib/x86_64-linux-gnu/dri.
What is the purpose of these shared object files? Why plot() does not give error and plot3() does? What does libGL error mean? And how to resolve it?
There are other places that try to address similar problems but they are in different context and difficult for me to extrapolate for my purposes. I would like an answer specific to my problem.
Most unexpectedly, i have also noted that this problem does not happen in R2016a because MATLAB selects its own graphics rendering engine as software opengl and sets it up automatically for its purpose.

채택된 답변

Samarth Shah
Samarth Shah 2016년 8월 9일
Note - According to MathWorks' System Requirement and Availability document, Ubuntu 16.04 is not fully tested with any versions of MATLAB, so it is not recommended to use Ubuntu 16.04 with MATLAB.
Also, this question is similar to this question
For reference: r600 is the name of the Hardware driver provided by AMD Radeon. The Radeon driver is already pre-installed on Ubuntu. The r600 driver used for Hardware OpenGL. While swrast driver is just used in Software OpenGL.
As for your issue:
  • plot3() does 3-D rendering, and plot() does 2-D rendering.
  • MATLAB is shipped with a version of "libstdc++" (a system standard library) to ensure that there is a minimum amount of functionality in the library to support MATLAB
  • This is done by inserting the location of our "libstdc++" in the library search path before the system version’s location.
  • The issue arises when we pull in libraries that we haven’t built (graphics drivers being one of them), that rely on a version of "libstdc++" that is a newer version than the one we ship. In all likelihood, the graphics driver has expectations of entry points and functionality that may not exist in our older version of "libstdc++".
Potential workaround:
If this situation occurs, rename the file found at " $MATLAB_ROOT$/sys/os/glnxa64/libstdc++.so.6" to "libstdc++.so.6.old", restart MATLAB, this forces MATLAB to use the OS library.
Where,
$MATLABROOT can be found out by typing in the command "matlabroot" in your MATLAB Command Window.
  댓글 수: 6
Oleg Davydov
Oleg Davydov 2018년 7월 23일
편집: Oleg Davydov 2018년 7월 23일
worked for me, too: intel driver i965, opensuse Leap 15.0, MATLAB R2017b
William Chamberlain
William Chamberlain 2018년 10월 21일
편집: William Chamberlain 2018년 10월 21일
This is similar to this this comment/answer by @Abhrajit - which worked for me on Ubuntu 14.04 with Matlab2016a.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Michael Makovi
Michael Makovi 2017년 10월 13일
편집: Walter Roberson 2018년 1월 16일
I am using Linux Mint 18.1 with Matlab R2017a. I tried the above, and it did indeed remove the "r600_dri.so" and "swrast_dri.so" errors in the terminal, but now I receive a new error within Matlab itself:
com.jogamp.opengl.GLException: X11GLXDrawableFactory - Could not initialize shared resources for X11GraphicsDevice[type .x11, connection :0, unitID 0, handle 0x0, owner false, ResourceToolkitLock[obj 0x391383c6, isOwner false, <30305970, 363fe0c7>[count 0, qsz 0, owner <NULL>]]]
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:326)
at jogamp.opengl.SharedResourceRunner.run(SharedResourceRunner.java:297)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:688)
at jogamp.opengl.GLContextImpl.makeCurrent(GLContextImpl.java:580)
at jogamp.opengl.x11.glx.X11GLXDrawableFactory$SharedResourceImplementation.createSharedResource(X11GLXDrawableFactory.java:297)
... 2 more
Exception in thread "Startup Class Loader" java.lang.InternalError: XXX0 profile[1]: GL3bc -> profileImpl GL4bc !!! not mapped
at com.jogamp.opengl.GLProfile.computeProfileMap(GLProfile.java:2047)
at com.jogamp.opengl.GLProfile.initProfilesForDeviceCritical(GLProfile.java:1917)
at com.jogamp.opengl.GLProfile.initProfilesForDevice(GLProfile.java:1866)
at com.jogamp.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1835)
at com.jogamp.opengl.GLProfile.access$000(GLProfile.java:79)
at com.jogamp.opengl.GLProfile$1.run(GLProfile.java:229)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.opengl.GLProfile.initSingleton(GLProfile.java:215)
at com.mathworks.hg.peer.JavaSceneServerPeer.initializeJOGL(JavaSceneServerPeer.java:149)
at com.mathworks.hg.peer.JavaSceneServerPeer.<clinit>(JavaSceneServerPeer.java:119)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.mathworks.mde.desk.StartupClassLoader.loadClass(StartupClassLoader.java:262)
at com.mathworks.mde.desk.StartupClassLoader.access$900(StartupClassLoader.java:25)
at com.mathworks.mde.desk.StartupClassLoader$2.run(StartupClassLoader.java:248)
at java.lang.Thread.run(Unknown Source)
  댓글 수: 4
Andrew Cox
Andrew Cox 2018년 1월 17일
No, I'm using an AMD card (Southern Islands - Pitcairn, or model HD 7850) with the radeon/amdgpu drivers. I get the same error on R2017b, R2016b, and R2015b.
Andrew Cox
Andrew Cox 2018년 1월 17일
I just created a new question with many more details.

댓글을 달려면 로그인하십시오.


Bashid
Bashid 2019년 4월 25일
In Ubuntu 18.04 LTS and With Matlab2014b, below approach works as Samarth Shah said
rename the file found at " $MATLAB_ROOT$/sys/os/glnxa64/libstdc++.so.6" to "libstdc++.so.6.old", restart MATLAB.
  댓글 수: 2
Jisu Ro
Jisu Ro 2020년 6월 15일
my god..
I was thinking about re-install nvidia driver or something..
But this simple solution worked for me thanks.

댓글을 달려면 로그인하십시오.


Willem van Boxtel
Willem van Boxtel 2021년 11월 18일
This worked for me on Ubuntu 20.04 running Matlab 2021b as well, thank you so much!

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by