====== How to Compile MATLAB Mex Files ======
===== general guidelines =====
In MATLAB: cd stprtoolbox_path
stprpath
compilemex
% when compilemex complains about missing compiler run mex -setup and then compilemex again
If you are not successful, do not hesitate to contact us in the student forum. Please post output of the MATLAB ''ver'' command.
===== OS X =====
- Install Xcode https://itunes.apple.com/us/app/xcode/id497799835?mt=12
- Install Command line tools in XCode ''Preferences -> Downloads -> Command line tools'' {{courses:ae4b33rpz:labs:08_svm:xcode_preferences.jpg|}}
- Solve this bug: http://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/
- Comment out lines 144-145 in ''stprtool/compilemex.m''
elseif strncmp(cname,'MAC',3)
% p = strrep(p,':',':;');
% p = strrep(p,'/',':');
- In MATLAB
cd stprtool_path/
compilemex('../stprtool')
Command output should look like:
Compiling MEX files of STPRtool...
mex -O -I../stprtool/kernels -outdir ../stprtool/kernels ../stprtool/kernels/kernel.c ../stprtool/kernels/kernel_fun.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/kernels -outdir ../stprtool/kernels ../stprtool/kernels/diagker.c ../stprtool/kernels/kernel_fun.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/kernels -outdir ../stprtool/svm ../stprtool/svm/smo1d_mex.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/kernels -outdir ../stprtool/svm ../stprtool/svm/smo_mex.c ../stprtool/kernels/kernel_fun.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/kernels -outdir ../stprtool/svm ../stprtool/svm/bsvm2_mex.c ../stprtool/kernels/kernel_fun.c ../stprtool/optimization/gmnplib.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/ -outdir ../stprtool/misc ../stprtool/misc/knnclass_mex.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/kernels -outdir ../stprtool/svm ../stprtool/svm/svm2_mex.c ../stprtool/kernels/kernel_fun.c ../stprtool/optimization/gnpplib.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/kernels -outdir ../stprtool/kernels ../stprtool/kernels/kernelproj_mex.c ../stprtool/kernels/kernel_fun.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/ -outdir ../stprtool/optimization ../stprtool/optimization/gmnp_mex.c ../stprtool/optimization/gmnplib.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/ -outdir ../stprtool/optimization ../stprtool/optimization/gnnls_mex.c ../stprtool/optimization/gnnlslib.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/ -outdir ../stprtool/optimization ../stprtool/optimization/gnpp_mex.c ../stprtool/optimization/gnpplib.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/ -outdir ../stprtool/optimization ../stprtool/optimization/qpssvm_mex.c ../stprtool/optimization/qpssvmlib.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/ -outdir ../stprtool/optimization ../stprtool/optimization/qpbsvm_mex.c ../stprtool/optimization/qpbsvmlib.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
mex -O -I../stprtool/ -outdir ../stprtool/optimization ../stprtool/optimization/gsmo_mex.c ../stprtool/optimization/gsmolib.c
/Applications/MATLAB_R2012a.app/bin/mex: line 1022: [: /Volumes/Mac: binary operator expected
MEX-files compiled successfully.
Thanks to Martin PekaĆ for OS X howto.