Could anyone know how to use Xcode 5.0 as my C or C++ compiler in MATLAB 2012b or later?

조회 수: 3 (최근 30일)
dai
dai 2013년 9월 30일
편집: Daniel 2013년 11월 6일
MAC OS X 10.8.5
Xcode 5.0 (command line tools have installed)
Matlab 2012b
>> mex -setup
Options files control which compiler to use, the compiler and link command
options, and the runtime libraries to link against.
Using the 'mex -setup' command selects an options file that is
placed in /Users/Yydai168/.matlab/R2012b and used by default for 'mex'. An options
file in the current working directory or specified on the command line
overrides the default options file in /Users/Yydai168/.matlab/R2012b.
To override the default options file, use the 'mex -f' command
(see 'mex -help' for more information).
The options files available for mex are:
1: /Applications/MATLAB_R2012b.app/bin/mexopts.sh :
Template Options file for building gcc MEX-files
0: Exit with no changes
Enter the number of the compiler (0-1): 1
Overwrite /Users/Yydai168/.matlab/R2012b/mexopts.sh ([y]/n)? y
/Applications/MATLAB_R2012b.app/bin/mexopts.sh is being copied to /Users/Yydai168/.matlab/R2012b/mexopts.sh
The ERROR:
>> mex test.c /Applications/MATLAB_R2012b.app/bin/mex: line 305: llvm-gcc-4.2: command not found /Applications/MATLAB_R2012b.app/bin/mex: line 1326: llvm-gcc-4.2: command not found
mex: compile of ' "test.c"' failed.
Error using mex (line 206) Unable to complete successfully.

답변 (3개)

Tschantz
Tschantz 2013년 10월 2일
I have the same problem here. Matlab 2013a and Xcode 5.0
  댓글 수: 1
dai
dai 2013년 10월 3일
I have solved it.
update matlab 2013a from matlab 2012b
install ”command line tools“ of xcode5.0
and replace ”10.7“ with ”10.8“ in /Applications/MATLAB_R2013a.app/bin/mexopts.sh
Good luck.

댓글을 달려면 로그인하십시오.


Ken Atwell
Ken Atwell 2013년 10월 4일
Dai got it right, replace "10.7" with "10.8" in mexopts.sh. Here is the MathWorks for this:

Giorgos
Giorgos 2013년 10월 14일
I have the same problem with Xcode 5.0 and MATLAB 2012b
I know that there is a solution for 2013a and 2013b:
but I need one for 2012b...!
Even this could not help me:
I always get:
/Applications/MATLAB_R2011b.app/bin/mex: line 305: llvm-gcc-4.2: command not found
  댓글 수: 3
Jorik
Jorik 2013년 10월 26일
편집: Jorik 2013년 10월 26일
That error seems to indicate you did not install the command-line tools.
Did you install them as indicated by the solution page 1-FR6LXJ you refer to? It is listed under "*** Before applying the patch *" Step 2.
It seems that with Xcode 5 you can download the command-line tools from: https://developer.apple.com/downloads/index.action#
Daniel
Daniel 2013년 11월 6일
편집: Daniel 2013년 11월 6일
I am having the same problems... is it possible there are some compatibility problems with the new mac os x 10.9 (mavericks)?
  • I am runnin MATLAB 2012b with Xcode 5.0 (on os 10.9)
  • I have command-line tools installed on Xcode 5.0
  • I've tried installing the patch
  • !xcodebuild -version identifies the correct version of Xcode
  • I have run mex -setup
I still receive the error
Making simulation target "bearing_sfun", ...
/Applications/MATLAB_R2012b.app/bin/mex -c -O -DMATLAB_MEX_FILE -I/Applications/MATLAB_R2012b.app/toolbox/stateflow/stateflow/../../../simulink/include -I/Applications/MATLAB_R2012b.app/toolbox/stateflow/stateflow/../../../extern/include -I/Applications/MATLAB_R2012b.app/stateflow/c/mex/include -I/Applications/MATLAB_R2012b.app/stateflow/c/debugger/include bearing_sfun.c /Applications/MATLAB_R2012b.app/bin/mex: line 305: llvm-gcc-4.2: command not found /Applications/MATLAB_R2012b.app/bin/mex: line 1326: llvm-gcc-4.2: command not found
mex: compile of ' "bearing_sfun.c"' failed.
gmake: * [bearing_sfun.o] Error 1
any ideas? This is becoming a serious time sync!
thanks in advance, dan
[edit] I found this post that solved the problem for my setup http://www.mathworks.com/matlabcentral/answers/103258-mex-on-mavericks-with-r2012b

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by