问题描述
Ubuntu 22.04运行MATLAB 2020a的故障报错如下:
- Failed to load module “canberra-gtk-module”
- symbol lookup error: /lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: g_memdup2
Failed to load module "canberra-gtk-module"
/home/n0name/software/matlab_2020a_install/bin/glnxa64/jcef_helper: symbol lookup error: /lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: g_memdup2
问题1解决
# 定位shared object 文件
n0name@xm:~$ locate libcanberra-gtk-module
/snap/gnome-3-28-1804/194/usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libcanberra-gtk-module.so
/snap/gnome-3-28-1804/198/usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libcanberra-gtk-module.so
/snap/gnome-3-38-2004/137/usr/lib/gtk-3.0/modules/libcanberra-gtk-module.so
/snap/gnome-3-38-2004/140/usr/lib/gtk-3.0/modules/libcanberra-gtk-module.so
/usr/lib/x86_64-linux-gnu/gtk-3.0/modules/libcanberra-gtk-module.so
# GTK (GIMP Toolkit) 是一套用于创建图形用户界面的工具包
# Ubuntu22.04安装了libcanberra-gtk3-module(gtk-3.0+),而Matlab需要调用的是gtk-2.0+的canberra动态链接库
# 操作系统版本
n0name@xm:~$ uname -a
Linux xm 5.19.0-41-generic #42~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 17:40:00 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
# 进入/usr/lib/x86_64-linux-gnu, 发现安装的是gtk3.0+
n0name@xm:/usr/lib/x86_64-linux-gnu$ ls | grep "libcanberra*"
libcanberra-0.30
libcanberra-gtk3.so.0
libcanberra-gtk3.so.0.1.9
libcanberra-gtk.so.0
libcanberra-gtk.so.0.1.9
libcanberra.so.0
libcanberra.so.0.2.5
# 进入/usr/lib查看,发现没有canberra文件
# linux默认库是从“/usr/lib/”路径下找,而canberra动态链接库位于“/usr/lib/x86_64-linux-gnu/”路径下;
# 1. 安装gtk 2.0+的版本
sudo apt-get install libcanberra-gtk-module -y
# 2. 查看是否安装成功 查看路径:/usr/lib/x86_64-linux-gnu/gtk-2.0/modules
n0name@xm:/usr/lib/x86_64-linux-gnu/gtk-2.0/modules$ ls
libatk-bridge.so libcanberra-gtk-module.so libferret.so libgail.so
n0name@xm:/usr/lib/x86_64-linux-gnu/gtk-2.0/modules$
# 3. 创建软链接
sudo ln -s /usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libcanberra-gtk-module.so /usr/lib/libcanberra-gtk-module.so
# 以上为解决 Failed to load module "canberra-gtk-module" 问题
问题2解决
# 打开MATLAB后在命令行输入:
# 1. 查看版本
>> version
ans =
'9.8.0.1323502 (R2020a)'
# 2. 查看安装路径
>> cd(matlabroot)
>> pwd
ans =
'/home/n0name/software/matlab_2020a_install'
# 3. 查看问题
>> !bin/glnxa64/MATLABWindow
bin/glnxa64/MATLABWindow: symbol lookup error: /lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: g_memdup2
# 4. 解决以上问题
# 在 bash terminal中
# 进入 <安装路径>/cefclient/sys/os/glnxa64
cd ~/software/matlab_2020a_install/cefclient/sys/os/glnxa64
# 创建文件夹
sudo mkdir exclude
# 移动白色的文件
sudo mv libgio-2.0.so* exclude
sudo mv libglib-2.0.so* exclude
sudo mv libgmodule-2.0.so* exclude
sudo mv libgobject-2.0.so* exclude
sudo mv libgthread-2.0.so* exclude
参考回答:
问题3
- 问题:Error using opengl Switching to software OpenGL rendering at runtime on unix is not supported(Warning: MATLAB has disabled some advanced graphics rendering features by switching to software
OpenGL.) - 并且经常显示message service fatally disconnected
解决:
1.
2.
问题4
>> opengl hardware
MATLAB has experienced a low-level graphics error, and may not have drawn correctly.
Read about what you can do to prevent this issue at Resolving Low-Level Graphics Issues then restart MATLAB.
To share details of this issue with MathWorks technical support,
please include this file with your service request.
gfx12 and newer are not supported on i965
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: i965
gfx12 and newer are not supported on i965
libGL error: glx: failed to create dri2 screen
libGL error: failed to load driver: i965
libGL error: 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, suffix _dri)
libGL error: failed to load driver: swrast
gfx12 and newer are not supported on i965
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: i965
gfx12 and newer are not supported on i965
libGL error: glx: failed to create dri2 screen
libGL error: failed to load driver: i965
libGL error: 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, suffix _dri)
libGL error: failed to load driver: swrast
gfx12 and newer are not supported on i965
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: i965
gfx12 and newer are not supported on i965
libGL error: glx: failed to create dri2 screen
libGL error: failed to load driver: i965
libGL error: 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, suffix _dri)
libGL error: failed to load driver: swrast
libGL error: failed to load driver: i965
n0name@xm:~$ locate i965_dri.so
/snap/gnome-3-28-1804/194/usr/lib/x86_64-linux-gnu/dri/i965_dri.so
/snap/gnome-3-28-1804/198/usr/lib/x86_64-linux-gnu/dri/i965_dri.so
/snap/gnome-3-38-2004/137/usr/lib/x86_64-linux-gnu/dri/i965_dri.so
/snap/gnome-3-38-2004/140/usr/lib/x86_64-linux-gnu/dri/i965_dri.so
/usr/lib/x86_64-linux-gnu/dri/i965_dri.so
- 后来替换成:
opengl('save','software')