1.问题描述
在Ubuntu15.04及更新系统中安装了Matlab 2016a,成功激活后启动,遇到了启动奔溃(crash)问题,截图如下:
MATLAB crash file:/home/wjq/matlab_crash_dump.13999-1:
------------------------------------------------------------------------
Segmentation violation detected at Sun Oct 2 20:58:15 2016
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Crash Mode : continue (default)
Current Graphics Driver: Unknown software
Current Visual : 0x21 (class 4, depth 24)
Default Encoding : UTF-8
GNU C Library : 2.21 stable
Host Name : XXX
MATLAB Architecture : glnxa64
MATLAB Root : /usr/local/programFiles/MATLAB/R2016a
MATLAB Version : 9.0.0.341360 (R2016a)
OpenGL : software
Operating System : Linux 4.2.0-42-generic #49-Ubuntu SMP Tue Jun 28 21:26:26 UTC 2016 x86_64
Processor ID : x86 Family 6 Model 94 Stepping 3, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (11702000), display :0
Fault Count: 1
Abnormal termination:
Segmentation violation
Register State (from fault):
RAX = 0000000000000000 RBX = 00007f56311a6808
RCX = 0000000000000000 RDX = 0000000000000003
RSP = 00007f56d3ff8d10 RBP = 00007f56d3ff8e30
RSI = 0000000000000000 RDI = 00007f56311a29e8
R8 = 0000000000000018 R9 = 0000000000000000
R10 = 00007f56311a2000 R11 = 00007f56311a7450
R12 = 00007f56313c2f80 R13 = 0000000000000006
R14 = 00007f56311a3cc0 R15 = 00007f564c6327e0
RIP = 00007f56f27d78ca EFL = 0000000000010206
CS = 0033 FS = 0000 GS = 0000
Stack Trace (from fault):
[ 0] 0x00007f56f27d78ca /lib64/ld-linux-x86-64.so.2+00051402
[ 1] 0x00007f56f27e04c1 /lib64/ld-linux-x86-64.so.2+00087233
[ 2] 0x00007f56f27db474 /lib64/ld-linux-x86-64.so.2+00066676
[ 3] 0x00007f56f27df9b3 /lib64/ld-linux-x86-64.so.2+00084403
[ 4] 0x00007f56efbaafc9 /lib/x86_64-linux-gnu/libdl.so.2+00004041
[ 5] 0x00007f56f27db474 /lib64/ld-linux-x86-64.so.2+00066676
[ 6] 0x00007f56efbab62d /lib/x86_64-linux-gnu/libdl.so.2+00005677
[ 7] 0x00007f56efbab061 /lib/x86_64-linux-gnu/libdl.so.2+00004193 dlopen+00000049
[ 8] 0x00007f56ec3f60b6 /usr/local/programFiles/MATLAB/R2016a/bin/glnxa64/libut.so+00315574
[ 9] 0x00007f56ec3f6c76 /usr/local/programFiles/MATLAB/R2016a/bin/glnxa64/libut.so+00318582 _Z11utGetModuleRKSbIDsSt11char_traitsIDsESaIDsEEPi+00000022
2.Bug原因
引起这种错误的原因是Ubuntu15.04及以上版本包含更新版本的libstdc++.so.6,而Matlab使用的是较旧版本(versioin 6.0.17)。当Matlab首先加载
/usr/local/MATLAB/R2016a/sys/os/glnxa64 中的libstdc++.so.6.0.17时,操作系统收到一个Matlab引起的不兼容错误(incompatibility),从而引发启动奔溃(crash)。
3.修正方法
可以强制使Matlab加载由操作系统提供的更新版的libstdc++库,通过以下三个操作完成:
1].定位Matlab的安装目录,默认是/usr/local/MATLAB/R2016a ;
2].进入sys/os/glnxa6 目录
$ cd /usr/local/programFiles/MATLAB/R2016a/sys/os/glnxa64 ;
3].重命名libstdc++.so.6 共享库为 libstdc++.so.6.bak
# mv libstdc++.so.6 libstdc++.so.6.bak
MathWorks官方只对libstdc++.so.6(version 20)做了有限的测试。目前,这个Bug已经在R2016b(9.1)中修复。