MATLAB: Installation of SVMstruct: mex command not found

xcode mex

I try to install SVMstruct http://www.robots.ox.ac.uk/~vedaldi/code/svm-struct-matlab.html. When executing
make
I get the following error in my Terminal:
mex CC='gcc' LD='gcc' -largeArrayDims -maci64 CFLAGS='$CFLAGS -m64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.4 -Wall' LDFLAGS='$LDFLAGS -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.4' -outdir "build/maci64/" -c "svm_struct_learn_custom.c"
/bin/sh: mex: command not found
make: *** [build/maci64/svm_struct_learn_custom.o] Error 127
Does someone know how to solve this problem?

Best Answer

Pia - did you download svm-struct-matlab-1.2, or a previous version? Have you built MEX functions before, or is this the first time?
The README_MATLAB.txt indicates that To compile this software use the included Makefile. It should work out of the box on Linux and Mac OS X provided that MATLAB MEX program is in the command line path. So just issue make...
It then goes on to say that if MEX is not on the command line, the path can be specified as
make MEX=<MATLABROOT>/bin/mex
where MATLABROOT is the path returned by running matlabroot in the MATLAB Command Window.
If that doesn't work, it may be that you don't have a C/C++ compiler installed. In the MATLAB Command Window, type
mex -setup
What do you see when you do this? When I run the above (on OS X 10.8.5), I see
MEX configured to use 'Xcode with Clang' for C language compilation.
I had to download Xcode in order to compile C/C++ functions. See Mac OS X supported compilers for details.