4

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.
Pierson Sargent
  • 175
  • 2
  • 18
  • have you setup your `mex` compiler? try `>> mex -setup` – Shai Nov 10 '13 at 09:03
  • 1
    Hey Shai, thanks for the suggestion, strangely enough I believe it had to do with the OSX version set within the external compiler section of MatLab. Once I changed all of the values to 10.8 that originally read 10.7 and downloaded Xcode, everything worked beautifully. – Pierson Sargent Nov 11 '13 at 04:05
  • @PiersonSargent where did you change the values of 10.7 to 10.8? Because I am using 10.9, I may have the same problem emerging... – hhh Nov 14 '13 at 15:58
  • 1
    I'd have to search around for it, it's a mexopts (mex options) file that exists within MatLab's files. Try seeing if you can't run a search for that. – Pierson Sargent Nov 21 '13 at 14:13

2 Answers2

2

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

Community
  • 1
  • 1
hhh
  • 50,788
  • 62
  • 179
  • 282
0

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

Pierson Sargent
  • 175
  • 2
  • 18