Hey trying to compile one C-file in MatLab, but I got this error and I'm trying to make sense of it. Any and all guidance is greatly appreciated.
>> mex BDS_unpack_mex5.c
xcrun: error: SDK "macosx10.7" cannot be located
clang: warning: no such sysroot directory: '-mmacosx-version-min=10.7'
BDS_unpack_mex5.c:17:10: fatal error: 'math.h' file not found
#include <math.h>
^
1 error generated.
mex: compile of ' "BDS_unpack_mex5.c"' failed.
Error using mex (line 206)
Unable to complete successfully.
In order to solve this compiling here or generally as in the question, I understand this so that
$ sed -ie 's@10.7@10.9@g' /Applications/MATLAB_R2013b.app/bin/mexopts.sh
where check your Sed flavour before running this. According to the comment you need compile Xcode again. Waiting for the upgrade...
Perhaps related questions
- How to ignore `mexopts.sh` when compiling MEX files for Matlab?
The problem existed within the version of OSX that MatLab thought I had given that the new OSX version came out (Mavericks) and I chose to install the update. I ended up finding the file that had mex options in it, changed the OSX values to read the current version of OSX, I downloaded the current version of Xcode and voila everything functioned and I could run my
mex BDS_unpack_mex5.c
Which allowed me to compile the mex file, use the function within and have a beautiful day =D