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

4 vues (au cours des 30 derniers jours)
dai
dai le 30 Sep 2013
Modifié(e) : Daniel le 6 Nov 2013
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.

Réponses (3)

Tschantz
Tschantz le 2 Oct 2013
I have the same problem here. Matlab 2013a and Xcode 5.0
  1 commentaire
dai
dai le 3 Oct 2013
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.

Connectez-vous pour commenter.


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

Giorgos
Giorgos le 14 Oct 2013
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 commentaires
Jorik
Jorik le 26 Oct 2013
Modifié(e) : Jorik le 26 Oct 2013
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 le 6 Nov 2013
Modifié(e) : Daniel le 6 Nov 2013
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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by