Matlab 2012a Mex to work with Xcode 4.5 on Mountai

2019-05-07 21:27发布

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条回答
地球回转人心会变
2楼-- · 2019-05-07 21:30

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)

查看更多
登录 后发表回答