mex in Mac OS X Lion

6 Ansichten (letzte 30 Tage)
yan
yan am 29 Apr. 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!

Antworten (3)

Walter Roberson
Walter Roberson am 29 Apr. 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 am 30 Apr. 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 am 22 Jun. 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 Kommentare
Chunyang
Chunyang am 5 Mär. 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 am 26 Aug. 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!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by