Borrar filtros
Borrar filtros

mex in Mac OS X Lion

5 visualizaciones (últimos 30 días)
yan
yan el 29 de Abr. de 2012
I need to run cmu target detecting code, it needs to run matlab code and c/c++ code. I had run it in Ubuntu successfully, and now I need to run it in Mac OS X Lion.
I have installed Matlab R2010b, and mex -setup, selected:
/Application/MATLAB_R2010b.app/bin/gccopts.sh Template Options file for building gcc MEX-files
Is that right? Then I hello.c, and error came:
/Application/MATLAB_R2010b.app/bin/mex: line 305: gcc-4.0: command not found
/Application/MATLAB_R2010b.app/bin/mex: line 104: g++-4.0: command not found
How can I fix it?
Thank so much!

Respuestas (3)

Walter Roberson
Walter Roberson el 29 de Abr. de 2012
(Note: if you are searching and you see questions about installing gcc-4.2 or gcc-4.3, then those are a different matter dealing with a newer version of MATLAB than you have.)

Ken Atwell
Ken Atwell el 30 de Abr. de 2012
You need to go back to Xcode version 4.0.1, which was current at the time of the release of R2010b (see the link that Walter provided). Apple makes it a tad tricky to get older releases, but they are said to be available to members of the developer program.
This link may be helpful in finding older releases of Xcode.

Peter Tenenbaum
Peter Tenenbaum el 22 de Jun. de 2012
I'm using the current version of Xcode with R2010b and Lion. I was able to get mex to work correctly by editing my mexopts.sh file. In the maci64) stanza I changed gcc-4.0 and g++-4.0 to just gcc and g++; I changed SDKROOT to '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/'; and I changed MACOSX_DEPLOYMENT_TARGET to '10.7' .
  2 comentarios
Chunyang
Chunyang el 5 de Mzo. de 2013
I have tried your answer. However, I still have the same error. Do we need to change other files as mex, etc? As the error says: bin/mex line 306 gcc-4.0 command not found...
Horvathi
Horvathi el 26 de Ag. de 2013
Please note that the mexopts.sh file may exist at different locations. The search order for the option file is the following:
1) ./$OPTSFILE_NAME
2) $HOME/.matlab/<rel_version>/$OPTSFILE_NAME
3) $MATLAB/bin/$OPTSFILE_NAME
Obviously the first one found will be used. You need to make sure that you have modified the correct option file.
In my case (using OSX 10.8 and Matlab R2009b) the second location was the valid. Modifying the correct file according to the description of Peter Tenenbaum solves the problem.
Good luck!

Iniciar sesión para comentar.

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by