0

I have 64-bit Mac, OS X 10.8.5, and I have xcode installed. I can also verify gcc works from the command line. When I type mex -setup I get

The options files available for mex are:

  1: /Applications/MATLAB_R2013a.app/bin/mexopts.sh : 
      Template Options file for building MEX-files


  0: Exit with no changes

This is unhelpful. And when I type make, with all of the relevant libsvm files in my folder of choice, I get

make
xcodebuild: error: SDK "macosx10.7" cannot be located.
xcrun: error: unable to find utility "clang", not a developer tool or in PATH

    mex: compile of ' "libsvmread.c"' failed.

If make.m fails, please check README about detailed instructions.

Is anyone able to help me with this?

Wesley Bland
  • 8,816
  • 3
  • 44
  • 59

1 Answers1

0

The quickest thing is to edit the mexopts.sh file directly, using your favorite text editor (you may need to do this with "Administrator Privileges"). The file:

/Applications/MATLAB_R2013a.app/bin/mexopts.sh

defines a bunch of paths and flags for invoking the C/C++ compiler on your system. It tends not to keep up with revisions to the MacOS.

On my system, I had to make the following changes:

lines 258-260

         CC='gcc'
         SDKROOT='/Developer/SDKs/MacOSX10.6.sdk'
         MACOSX_DEPLOYMENT_TARGET='10.6'

line 273

         CXX=g++

There will be many references to "CC=" in the file; you're looking for the ones that follow the line

         maci64)

But the correct values for your system depend on which gcc/g++ you have and where they are installed. As you can see, I have the MacOS 10.6 Developer tools installed under /Develop. You will need an install of the Developer tools (XCode) - see How to use/install gcc on Mac OS X 10.8 / Xcode 4.4

In more recent versions of the XCode tools, the path might look more like:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk

But compiling MEX code with more recent versions of XCode might cause other problems - I had issues with char16_t, see: MEX compile error: unknown type name 'char16_t'

Community
  • 1
  • 1
dpwe
  • 728
  • 5
  • 5