uricamic / clandmark

Open Source Landmarking Library
http://cmp.felk.cvut.cz/~uricamic/clandmark
GNU General Public License v3.0
199 stars 111 forks source link

Compiling Mac OSX Binaries for MATLAB interface - errors #61

Open jadisha opened 8 years ago

jadisha commented 8 years ago

Hello, Thanks for providing CLandMark. However, I couldn't compile successfully the Mac OSX Binaries for Matlab interface. Maybe, if you can provide theses ones for Mac OSX, I'll appreciate a lot.

I was facing a lot of errors, one of them was with the CType.h (https://github.com/uricamic/clandmark/blob/master/libclandmark/CTypes.h#L17 ) , where I read that I had to comment Line #17. But after doing "cmake install", I got this:

Building MEX extension /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface.mexmaci64 Verbose mode is on. No MEX options file identified; looking for an implicit selection. ... Looking for compiler 'Xcode Clang++' ... ... Executing command 'xcode-select -print-path' ...Yes ('/Applications/Xcode.app/Contents/Developer'). ... Looking for folder '/Applications/Xcode.app/Contents/Developer' ...Yes. ... Executing command 'which xcrun' ...Yes ('/usr/bin/xcrun'). ... Looking for folder '/usr/bin' ...Yes. ... Executing command 'defaults read com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense' ...Yes ('4.6.3'). ... Executing command ' agreed=4.6.3 if echo $agreed | grep -E '[\.\"]' >/dev/null; then lhs=expr "$agreed" : '([0-9])[.].' rhs=expr "$agreed" : '[0-9][.](.)$' if echo $rhs | grep -E '[\."]' >/dev/null; then rhs=expr "$rhs" : '([0-9])[.].'` fi if [ $lhs -gt 4 ] || ( [ $lhs -eq 4 ] && [ $rhs -ge 3 ] ); then echo $agreed else exit 1 fi fi' ...Yes ('4.6.3'). ... Executing command 'xcode-select -print-path' ...Yes ('/Applications/Xcode.app/Contents/Developer'). ... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' ...No. ... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk' ...No. ... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk' ...Yes. ... Executing command 'xcode-select -print-path' ...Yes ('/Applications/Xcode.app/Contents/Developer'). ... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' ...No. ... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk' ...No. ... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk' ...Yes. ... Executing command 'echo /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk | rev | cut -c1-10 | rev | egrep -oh '[0-9]+.[0-9]+'' ...Yes ('10.9'). Found installed compiler 'Xcode Clang++'.

Options file details

Compiler location: /Applications/Xcode.app/Contents/Developer
Options file: /Applications/MATLAB_R2014a.app/bin/maci64/mexopts/clang++_maci64.xml
CMDLINE100 : /usr/bin/xcrun -sdk macosx10.9 clang++ -c -DMATLAB_MEX_FILE  -I/Users/jadisha/Downloads/clandmark2/libclandmark  -I"/Applications/MATLAB_R2014a.app/extern/include" -I"/Applications/MATLAB_R2014a.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fobjc-arc -O2 -DNDEBUG /Users/jadisha/Downloads/clandmark2/matlab_interface/featuresPool_interface_mex.cpp -o /var/folders/q8/hc24__2x001_g1295456fn480000gn/T//mex_8738333904263_3010/featuresPool_interface_mex.o
CMDLINE200 : /usr/bin/xcrun -sdk macosx10.9 clang++ -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.9 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -framework Cocoa -bundle  -Wl,-exported_symbols_list,"/Applications/MATLAB_R2014a.app/extern/lib/maci64/mexFunction.map" -O -Wl,-exported_symbols_list,"/Applications/MATLAB_R2014a.app/extern/lib/maci64/mexFunction.map" /var/folders/q8/hc24__2x001_g1295456fn480000gn/T//mex_8738333904263_3010/featuresPool_interface_mex.o   /Users/jadisha/Downloads/clandmark2/build/libclandmark/libflandmark.a /Users/jadisha/Downloads/clandmark2/build/libclandmark/libclandmark.a  -L"/Applications/MATLAB_R2014a.app/bin/maci64" -lmx -lmex -lmat -o /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface.mexmaci64
CMDLINE300 : rm -f /var/folders/q8/hc24__2x001_g1295456fn480000gn/T//mex_8738333904263_3010/featuresPool_interface_mex.o
CXX : /usr/bin/xcrun -sdk macosx10.9 clang++
DEFINES : -DMATLAB_MEX_FILE 
MATLABMEX : -DMATLAB_MEX_FILE 
CXXFLAGS : -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fobjc-arc
INCLUDE : -I/Users/jadisha/Downloads/clandmark2/libclandmark  -I"/Applications/MATLAB_R2014a.app/extern/include" -I"/Applications/MATLAB_R2014a.app/simulink/include"
CXXOPTIMFLAGS : -O2 -DNDEBUG
CXXDEBUGFLAGS : -g
LDXX : /usr/bin/xcrun -sdk macosx10.9 clang++
LDFLAGS : -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.9 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -framework Cocoa -bundle  -Wl,-exported_symbols_list,"/Applications/MATLAB_R2014a.app/extern/lib/maci64/mexFunction.map"
LDBUNDLE : -bundle 
LINKEXPORT : -Wl,-exported_symbols_list,"/Applications/MATLAB_R2014a.app/extern/lib/maci64/mexFunction.map"
LINKLIBS : /Users/jadisha/Downloads/clandmark2/build/libclandmark/libflandmark.a /Users/jadisha/Downloads/clandmark2/build/libclandmark/libclandmark.a  -L"/Applications/MATLAB_R2014a.app/bin/maci64" -lmx -lmex -lmat
LDOPTIMFLAGS : -O
LDDEBUGFLAGS : -g
OBJEXT : .o
LDEXT : .mexmaci64
XCODE_DIR : /Applications/Xcode.app/Contents/Developer
XCRUN_DIR : /usr/bin
XCODE_AGREED_VERSION : 4.6.3
ISYSROOT : /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk
SDKVER : 10.9
MATLABROOT : /Applications/MATLAB_R2014a.app
ARCH : maci64
SRC : /Users/jadisha/Downloads/clandmark2/matlab_interface/featuresPool_interface_mex.cpp
OBJ : /var/folders/q8/hc24__2x001_g1295456fn480000gn/T//mex_8738333904263_3010/featuresPool_interface_mex.o
OBJS : /var/folders/q8/hc24__2x001_g1295456fn480000gn/T//mex_8738333904263_3010/featuresPool_interface_mex.o 
SRCROOT : /Users/jadisha/Downloads/clandmark2/matlab_interface/featuresPool_interface_mex
DEF : /var/folders/q8/hc24__2x001_g1295456fn480000gn/T//mex_8738333904263_3010/featuresPool_interface.def
EXP : /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface.exp
LIB : /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface.lib
EXE : /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface.mexmaci64
ILK : /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface.ilk
MANIFEST : /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface.mexmaci64.manifest
TEMPNAME : /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface
EXEDIR : /Users/jadisha/Downloads/clandmark2/build/matlab_interface/
EXENAME : featuresPool_interface
OPTIM : -O2 -DNDEBUG
LINKOPTIM : -O

Building with 'Xcode Clang++'. /usr/bin/xcrun -sdk macosx10.9 clang++ -c -DMATLAB_MEX_FILE -I/Users/jadisha/Downloads/clandmark2/libclandmark -I"/Applications/MATLAB_R2014a.app/extern/include" -I"/Applications/MATLAB_R2014a.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.9 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -fobjc-arc -O2 -DNDEBUG /Users/jadisha/Downloads/clandmark2/matlab_interface/featuresPool_interface_mex.cpp -o /var/folders/q8/hc24__2x001_g1295456fn480000gn/T//mex_8738333904263_3010/featuresPool_interface_mex.o /usr/bin/xcrun -sdk macosx10.9 clang++ -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.9 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -framework Cocoa -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2014a.app/extern/lib/maci64/mexFunction.map" -O -Wl,-exported_symbols_list,"/Applications/MATLAB_R2014a.app/extern/lib/maci64/mexFunction.map" /var/folders/q8/hc24__2x001_g1295456fn480000gn/T//mex_8738333904263_3010/featuresPool_interface_mex.o /Users/jadisha/Downloads/clandmark2/build/libclandmark/libflandmark.a /Users/jadisha/Downloads/clandmark2/build/libclandmark/libclandmark.a -L"/Applications/MATLAB_R2014a.app/bin/maci64" -lmx -lmex -lmat -o /Users/jadisha/Downloads/clandmark2/build/matlab_interface/featuresPool_interface.mexmaci64 clang: error: no such file or directory: '/Users/jadisha/Downloads/clandmark2/build/libclandmark/libflandmark.a' clang: error: no such file or directory: '/Users/jadisha/Downloads/clandmark2/build/libclandmark/libclandmark.a'

make[2]: * [matlab_interface/featuresPool_interface.mexmaci64] Error 255 make[1]: * [matlab_interface/CMakeFiles/featuresPool_interface.dir/all] Error 2 make: *\ [all] Error 2`

Also, when I tried to run the compile_mex.m file in Matlab, I got this: `Error using mex In file included from /Users/jadisha/Downloads/clandmark2/matlab_interface/flandmark_interface_mex.cpp:15: In file included from ../libclandmark/Flandmark.h:14: In file included from ../libclandmark/CLandmark.h:14: In file included from ../libclandmark/CAppearanceModel.h:21: In file included from ../3rd_party/CImg-1.5.6/CImg.h:9385: ../3rd_party/CImg-1.5.6/plugins/cimgmatlab.h:129:13: warning: 9 enumeration values not handled in switch: 'mxUNKNOWN_CLASS', 'mxCELL_CLASS', 'mxSTRUCT_CLASS'... [-Wswitch] switch (classID) { ^ ../3rd_party/CImg-1.5.6/plugins/cimgmatlab.h:205:39: error: cannot initialize a parameter of type 'mxClassID' with an lvalue of type 'int' if (nbdims>4 || !isNumericalClassID(classID)) { ^~~ ../3rd_party/CImg-1.5.6/plugins/cimgmatlab.h:98:41: note: passing argument to parameter 'id' here static int isNumericalClassID(mxClassID id) { ^ ../3rd_party/CImg-1.5.6/plugins/cimgmatlab.h:270:13: warning: 9 enumeration values not handled in switch: 'mxUNKNOWN_CLASS', 'mxCELL_CLASS', 'mxSTRUCT_CLASS'... [-Wswitch] switch (classID) { ^ ../3rd_party/CImg-1.5.6/plugins/cimgmatlab.h:129:13: warning: 9 enumeration values not handled in switch: 'mxUNKNOWN_CLASS', 'mxCELL_CLASS', 'mxSTRUCT_CLASS'... [-Wswitch] switch (classID) { ^ ../3rd_party/CImg-1.5.6/plugins/cimgmatlab.h:192:5: note: in instantiation of member function 'cimg_library::CImg<unsigned char>::makeImageFromMatlabData' requested here makeImageFromMatlabData(matlabArray,classID); ^ /Users/jadisha/Downloads/clandmark2/matlab_interface/flandmark_interface_mex.cpp:128:37: note: in instantiation of member function 'cimg_library::CImg::CImg' requested here cimg_library::CImg img(prhs[2]); ^ In file included from /Users/jadisha/Downloads/clandmark2/matlab_interface/flandmark_interface_mex.cpp:15: In file included from ../libclandmark/Flandmark.h:14: In file included from ../libclandmark/CLandmark.h:14: In file included from ../libclandmark/CAppearanceModel.h:21: In file included from ../3rd_party/CImg-1.5.6/CImg.h:9385: ../3rd_party/CImg-1.5.6/plugins/cimgmatlab.h:270:13: warning: 9 enumeration values not handled in switch: 'mxUNKNOWN_CLASS', 'mxCELL_CLASS', 'mxSTRUCT_CLASS'... [-Wswitch] switch (classID) { ^ /Users/jadisha/Downloads/clandmark2/matlab_interface/flandmark_interface_mex.cpp:841:18: note: in instantiation of member function 'cimg_library::CImg::toMatlab' requested here plhs[0] = nf->toMatlab(mxUINT8_CLASS); ^ 4 warnings and 1 error generated.

Error in compile_mex (line 37) eval(['mex -v -O -largeArrayDims flandmark_interface_mex.cpp ' include libclandmark ' -output ./mex/flandmark_interface']);`

I thank you in advance any help related to the correct installation of CLandmark in Mac OSX, especially for generating the .mex files for MATLAB.

uricamic commented 8 years ago

Hi @jadisha,

please use gist for submitting larger logs, it is difficult to read and parse here.

Have you tried to compile just the library and examples (without MATLAB interface)? Did that work?

The output from compile_mex.m looks like there is some problem with the CImg library. I haven't encountered any similar problem like this before. Maybe it is a problem of compatibility of some libraries/compilers.

I will check this with MacOS users. Sorry for a possible delay.

K0stIa commented 8 years ago

Hi @jadisha,

I am using OS X EI Capitan. @uricamic asked me to install CLandMark on my machine. I had not problem with installing it for matlab.

Maybe, providing sequence of commands that you do for installing matlab interface could help us to understand the source of the problem.

farshidfarhat commented 7 years ago

I did change the file "cimgmatlab.h" as follows and it worked: ... CImg & operator=(const mxArray *matlabArray) { int nbdims = (int)mxGetNumberOfDimensions(matlabArray); mxClassID classID = mxGetClassID(matlabArray); if (nbdims>4 || !isNumericalClassID(classID)) { ...