Matlab 2012a Mex to work with Xcode 4.5 on Mountain Lion

六月ゝ 毕业季﹏ 提交于 2019-12-07 08:55:09

问题


I have Mountain Lion installed with Xcode 4.5 and Matlab 2012a. I installed and ran the patch supplied on the MathWorks website however I still received the following error:

/Applications/MATLAB_R2012a.app/bin/mex: line 305: llvm-gcc-4.2: command not found
/Applications/MATLAB_R2012a.app/bin/mex: line 1326: llvm-gcc-4.2: command not found

mex: compile of ' "hello.c"' failed.
Error using mex (line 206)

Is there a known solution for that ?

Solution: Open Xcode --> Preferences --> Downloads --> Install "Command Line Tools"

The MathWorks patch is still needed. Resolved issue for me.


回答1:


You don't need to install XCode. I installed Command Line Tools and then edit the file "/Applications/MATLAB_R2012a.app/bin/mexopts.sh" and

changed CC from gcc-4.2 to llvm-gcc-4.2

changed CXX from gcc-4.2 to llvm-g++-4.2

set SDKROOT to '/'

It's done. Now, you just need to run "mex -setup" in MATLAB

Worked for me (Mac OSX 10.8.2, Command Line Tools - October 2012, MATLAB 2012a)



来源:https://stackoverflow.com/questions/12643236/matlab-2012a-mex-to-work-with-xcode-4-5-on-mountain-lion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!