Xcode builder error when installing SPM on Mac

When the software Statistical Parametric Mapping (SPM) is installed on the Mac platform, the app Xcode is required to compile mex files. A basic guide for installation is introduced in the following Wiki page. You might suffer from the following error
xcodebuild: error: SDK "macosx10.7" cannot be located.
It may be caused by technical incompatibility between Xcode and SPM. To solve this problem, the following customization would be helpful.

Step 1. SPM option

To let SPM use the correct mex functions, put the full path at the term MEXBIN in the file /src/makefile.var as follows as an example
MEXBIN = /Applications/MATLAB_R2012a.app/bin/mex

Step 2. MATLAB option

Go to the SDK directory in Xcode to check the SDK version as introduced in this discussion; for example,
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
Then you would see the files such as "MacOSX10.xx.sdk". Open MATLAB, and execute the following command
mex -setup
then select "1" so that a user-specific options file for building MEX-files named "mexopts.sh" is copied to a specified folder (shown in the command window) from the template option file. Open the file "mexopts.sh", and replace the original version (probably four texts) to updated version verified from the SDK directory; for example "10.7" to "10.9". After saving the file, follow the SPM installation process again. (For additional information, refer to the discussion).
Post a Comment