Compiling Mex files in Mac 10.9
1 次查看(过去 30 天)
显示 更早的评论
I'm trying to compile a mex file (in OS X 10.9) To be more specific, I'm trying to install the function SVMStruct (from http://www.robots.ox.ac.uk/~vedaldi/code/svm-struct-matlab.html#ssvm.download) but lack of mex command on my mac prevents from doing so. Here is the complete error message after typing
make MEX=/Applications/MATLAB_R2013a.app/bin/mex
/Applications/MATLAB_R2013a.app/bin/mex -largeArrayDims - CFLAGS='$CFLAGS -Wall' LDFLAGS='$LDFLAGS ' -outdir "build//" -c "svm_struct_api.c"
mex: - not a valid option.
Usage:
MEX [option1 ... optionN] sourcefile1 [... sourcefileN]
[objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN]
Use the -help option for more information, or consult the MATLAB External Interfaces Guide.
make: *** [build//svm_struct_api.o] Error 1
And this is the error message I receive when typing
make MEX=/Applications/MATLAB_R2013a.app/bin/mex ARCH=maci64
/Applications/MATLAB_R2013a.app/bin/mex -largeArrayDims -maci64 CFLAGS='$CFLAGS -m64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.4 -Wall' LDFLAGS='$LDFLAGS -mmacosx- version-min=10.4' -outdir "build/maci64/" -c "svm_struct_api.c"
xcrun: error: SDK "macosx10.7" cannot be located
clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.6.sdk'
svm_struct_api.c:20:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
mex: compile of ' "svm_struct_api.c"' failed.
make: *** [build/maci64/svm_struct_api.o] Error 1
The error talks about Mac OS X 10.6 and 10.7 but I'm using 10.9.
0 个评论
采纳的回答
Geoff Hayes
2014-10-11
Kamil - I observed the same error when running Make (from the terminal window, in the folder /Users/geoff/.../svm-struct-matlab-1.0) as make ARCH=maci64
...
Building with 'Xcode with Clang'.
clang: warning: no such sysroot directory: '/Developer/SDKs/MacOSX10.6.sdk'
/Users/geoff/.../svm-struct-matlab-1.0/svm_struct_api.c:20:10: fatal error: 'stdio.h' file not
found #include <stdio.h>
...
The Makefile has the following lines (of interest)
# Mac OS X Intel 32
ifeq ($(ARCH),maci)
SDKROOT ?= /Developer/SDKs/MacOSX10.6.sdk
This folder doesn't exist on my computer (OS X 10.8.5). Since MEX has been configured to use 'Xcode with Clang', the equivalent SDKs directory is
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
Within this directory, I have
MacOSX10.8.sdk
MacOSX10.9.sdk
So I changed the line in the Makefile from the
SDKROOT ?= /Developer/SDKs/MacOSX10.6.sdk
to
SDKROOT ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
and then re-ran make ARCH=maci64 and the svm_struct_learn.mexmaci64 file was built. (Running, in the Command Window of MATLAB, test_svm_struct_learn was successful).
I suggest you try updating the Makefile, in a similar manner as described above, with the appropriate MacOSX10.X.sdk.
5 个评论
Geoff Hayes
2014-10-13
Perhaps you deleted a single quote from around the '10.8' in the mexopts.sh file. Verify that the modifications you made to the file didn't accidentally remove a quote. i.e. should look like
MACOSX_DEPLOYMENT_TARGET='10.8'
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Troubleshooting in MATLAB Compiler SDK 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!