mac环境下,matlab出现的
/Applications/MATLAB_R2011b.app/bin/mex: line 305: gcc-4.2: command not found
原因:
xcode 3采用的编译器使是gcc,现在都改成llvm了。
解决方案:
1.查看Mac OS 系统版本,下载对应的patch
10.6 (Snow Leopard), for Xcode versions 4.1 and 4.2 only
10.7 (Lion), for Xcode versions 4.1 to 4.6 only
10.8 (Mountain Lion), for Xcode versions 4.4 to 4.6 only
其中:
optsPatch_MACOSX6.patch => 10.6
optsPatch_MACOSX7.patch => 10.7
optsPatch_MACOSX8.patch => 10.8
path下载地址
2.启动matlab
3.在matlab界面,输入如下指令
cd(matlabroot)
!unzip -o ~/Downloads/optsPatch_MACOSX8.patch
~/Downloads/optsPatch_MACOSX8.patch 为之前下载的path的路径
4.在matlab界面,输入
mex -setup
5.接着输入
mbuild -setup
就可以了。
参考链接:
http://www.mathworks.cn/support/solutions/en/data/1-FR6LXJ/