Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling Library #9

Open
Riddlemirror opened this issue Aug 13, 2013 · 23 comments
Open

Compiling Library #9

Riddlemirror opened this issue Aug 13, 2013 · 23 comments

Comments

@Riddlemirror
Copy link

No matter how much I try, I keep getting the same error!

Compiling mex-files on Windows platform...

C:\PROGRA~1\MATLAB\R2010A\BIN\MEX.PL: Error: './mex/flandmark_detector_mex.cpp' not found.

please help

@uricamic
Copy link
Owner

Hi, could you please give me more details on how are you compiling the mex-files (like, if you have compiled the library itself successfully, and if you are trying to compile it from visual studio, or by running the enclosed flandmark_compilemex.m script)?

Thanks

PS: From the error message, it seems that there is just problem with path to the corresponding cpp file.

@uricamic
Copy link
Owner

And is ./mex/flandmark_detector_mex.cpp accessible from your current working directory? (try calling edit ./mex/flandmark_detector_mex.cpp from matlab command line)

@uricamic
Copy link
Owner

The opencv version shouldn't be a problem. The error reported is strange, though. Is this the only output you get? Maybe try to edit the flandmark_compilemex.m, by adding -v to lines containing calling of mex and then send me the full output.

@Riddlemirror
Copy link
Author

Compiling mex-files on Windows platform... This is mex, Copyright 1984-2007 The MathWorks, Inc. -> Default options filename found in C:\Users\Ruqayya Raza\AppData\Roaming\MathWorks\MATLAB\R2010a ---------------------------------------------------------------- -> Options file = C:\Users\Ruqayya Raza\AppData\Roaming\MathWorks\MATLAB\R2010a\mexopts.bat MATLAB = C:\PROGRA1\MATLAB\R2010A -> COMPILER = cl -> Compiler flags: COMPFLAGS = /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD OPTIMFLAGS = /O2 /Oy- /DNDEBUG DEBUGFLAGS = /Z7 arguments = -I../LIBFLA1/ -IC:\OPENCV1.5\BUILD\INCLUDE\OPENCV\ -IC:\OPENCV1.5\BUILD\INCLUDE\ Name switch = /Fo -> Pre-linking commands = -> LINKER = link -> Link directives: LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\PROGRA1\MATLAB\R2010A\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\RUQAYY1\APPDATA\LOCAL\TEMP\MEX_SG1\templib.x" /MAP:"C:\USERS\RUQAYY1\DESKTOP\FLANDM1\MATLAB1\MEX\flandmark_detector.mexw64.map" LINKDEBUGFLAGS = /DEBUG /PDB:"C:\USERS\RUQAYY1\DESKTOP\FLANDM1\MATLAB1\MEX\flandmark_detector.mexw64.pdb" LINKFLAGSPOST = Name directive = /out:"C:\USERS\RUQAYY1\DESKTOP\FLANDM1\MATLAB1\MEX\flandmark_detector.mexw64" File link directive = Lib. link directive = Rsp file indicator = @ -> Resource Compiler = rc /fo "C:\USERS\RUQAYY1\DESKTOP\FLANDM1\MATLAB1\MEX\mexversion.res" -> Resource Linker = ---------------------------------------------------------------- --> cl -I../LIBFLA1/ -IC:\OPENCV1.5\BUILD\INCLUDE\OPENCV\ -IC:\OPENCV1.5\BUILD\INCLUDE\ /c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD /FoC:\USERS\RUQAYY1\APPDATA\LOCAL\TEMP\MEX_SG1\flandmark_detector_mex.obj -IC:\PROGRA1\MATLAB\R2010A\extern\include -IC:\PROGRA1\MATLAB\R2010A\simulink\include /O2 /Oy- /DNDEBUG MEX\flandmark_detector_mex.cpp flandmark_detector_mex.cpp MEX\flandmark_detector_mex.cpp(26) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data MEX\flandmark_detector_mex.cpp(26) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data Warning: MEX could not find the library "flandmark_static" specified with -l option. MEX looked for a file with one of the names: flandmark_static.lib libflandmark_static.lib MEX looked for the library in the following directories: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\LIB\x64 C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\LIB\amd64 C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB\amd64 C:\PROGRA1\MATLAB\R2010A\extern\lib\win64 C:\PROGRA1\MATLAB\R2010A\extern\lib\win64\microsoft ../bin7/libflandmark/Release Contents of C:\USERS\RUQAYY1\APPDATA\LOCAL\TEMP\MEX_SG1\mex_tmp.rsp: C:\USERS\RUQAYY1\APPDATA\LOCAL\TEMP\MEX_SG1\flandmark_detector_mex.obj C:\OPENCV1.5\BUILD\X64\VC10\lib C:\OPENCV1.5\BUILD\X64\VC10\lib --> link /out:"C:\USERS\RUQAYY1\DESKTOP\FLANDM1\MATLAB1\MEX\flandmark_detector.mexw64" /dll /export:mexFunction /LIBPATH:"C:\PROGRA1\MATLAB\R2010A\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /incremental:NO /implib:"C:\USERS\RUQAYY1\APPDATA\LOCAL\TEMP\MEX_SG1\templib.x" /MAP:"C:\USERS\RUQAYY1\DESKTOP\FLANDM1\MATLAB1\MEX\flandmark_detector.mexw64.map" @C:\USERS\RUQAYY1\APPDATA\LOCAL\TEMP\MEX_SG1\MEX_TMP.RSP LINK : fatal error LNK1181: cannot open input file 'C:\OPENCV1.5\BUILD\X64\VC10\lib.obj' C:\PROGRA1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'C:\USERS\RUQAYY1\DESKTOP\FLANDM1\MATLAB1\MEX\flandmark_detector.mexw64' failed. ??? Error using ==> mex at 222Unable to complete successfully.
Error in ==> flandmark_compilemex at 79 eval(['mex -O -v -largeArrayDims ./mex/flandmark_detector_mex.cpp -I../libflandmark/' include libflandmark cvlibs ' -output ../matlab_toolbox/mex/flandmark_detector']); >>

@uricamic
Copy link
Owner

I see, it seems that you haven't compiled the library first:

Warning: MEX could not find the library "flandmark_static" specified with -l option. MEX looked for a file with one of the names: flandmark_static.lib libflandmark_static.lib

or maybe you have, but in the matlab script the relative path for binaries on windows is set to bin7, so, please compile the library first or if you have compiled to different directory, change the path in flandmark_compilemex.m accordingly.

@Riddlemirror
Copy link
Author

Ok so I am trying to build the libflandmark using CMAKE but I keep getting this error now.

The C compiler identification is MSVC 16.0.40219.1
The CXX compiler identification is MSVC 16.0.40219.1
Check for working C compiler using: Visual Studio 10
Check for working C compiler using: Visual Studio 10 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 10
Check for working CXX compiler using: Visual Studio 10 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
CMake Warning at /OpenCV2.3/cmake/OpenCVConfig.cmake:153 (message):
Found OpenCV 2.4.3 Windows Super Pack but it has not binaries compatible
with your configuration.

  You should manually point CMake variable OpenCV_DIR to your build of OpenCV library.

Call Stack (most recent call first):
CMakeLists.txt:2 (find_package)

CMake Error at CMakeLists.txt:2 (find_package):
Found package configuration file:

/OpenCV2.3/cmake/OpenCVConfig.cmake

but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.

Configuring incomplete, errors occurred!

@uricamic
Copy link
Owner

Unless you have OpenCV in your system path, you have to specify it manually, so just try to put path to the build directory of OpenCV to the field OpenCV_DIR and it should work.

@Riddlemirror
Copy link
Author

When I do that and hit configure again, the path is changed back to what it was originally!

P.S.Sorry to be such a pain

@uricamic
Copy link
Owner

I see, then maybe the quickest solution should be to add OpenCV to your system path. Because then cmake will find it and you will not need to specify it manually at all.

@Riddlemirror
Copy link
Author

I managed to configure the thing in CMAKE, had to change the directory from ./OpenCV/cmake to ./OpenCV/build.
I then built the project and I got the flandmark.static.dir and the flandmark.shared.dir. Now I am a bit lost as to how to get the lib files i.e.compile library.

@uricamic
Copy link
Owner

If you are using MS Visual Studio (and have checked that during initial run of cmake on the project) it should have produced the MS Visual studio solution file in the specified bin/build directory. There you can compile both static and dynamic version of flandmark (and some C++ example applications as well).

@Riddlemirror
Copy link
Author

Thank you so much!
Now when I try the flandmark_compilemex.m files, this is the error that comes up. I have tried to change the linker properties on the project and stuff, but to no avail.

Compiling mex-files on Windows platform...
LINK : fatal error LNK1181: cannot open input file 'C:\OPENCV2.3\BUILD\X64\VC10\lib.obj'

C:\PROGRA1\MATLAB\R2010A\BIN\MEX.PL: Error: Link of 'C:\USERS\RUQAYY1\DESKTOP\FLANDM1\MATLAB1\MEX\flandmark_detector.mexw64' failed.

??? Error using ==> mex at 222
Unable to complete successfully.

Error in ==> flandmark_compilemex at 79
eval(['mex -O -largeArrayDims ./mex/flandmark_detector_mex.cpp -I../libflandmark/' include libflandmark cvlibs '
-output ../matlab_toolbox/mex/flandmark_detector']);

@uricamic
Copy link
Owner

And have you checked that file 'C:\OPENCV2.3\BUILD\X64\VC10\lib.obj' for existance?

@Riddlemirror
Copy link
Author

Thats the thing...the openCV lib has a whole range of OpenCV library functions in it but no file with the obj extension. SO I dont understand what the program is looking for...?

@uricamic
Copy link
Owner

That's weird, I am not using windows anymore, but when I was using it, there were no problems with compiling the flandmark, once one had all paths set up appropriately and all pre-requisities installed. Especially, there were no problems with compiling mex-files, once one had successfully compiled the flandmark itself.
I will try to check it again, but I will have to boot to windows, which might take some time.

@Riddlemirror
Copy link
Author

Just a quick question though, WHY is it trying to find the obj file anyways? Because that obj isn't created when I debug and compile the flandmark lib. It's this line that's causing the problem:
libpath = ['c:\OpenCV' num2str(OpenCVmajor) '.' num2str(OpenCVminor) '\build\x64\vc10\lib'];

@uricamic
Copy link
Owner

that line just gives the path where the compiler should look for opencv compiled libraries, the .obj problem is windows related...

@renusharma
Copy link

Hello,
I too try to run flandmark_compilemex.m file from window system from matlab.Following error comes up:

Compiling mex-files on Windows platform...

Warning: MEX could not find the library "flandmark_static" specified with -l option.
MEX looked for a file with one of the names:
flandmark_static.lib
libflandmark_static.lib
MEX looked for the library in the following directories:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB\amd64
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB\amd64
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\x64
C:\Program Files\MATLAB\R2011a\extern\lib\win64
C:\Program Files\MATLAB\R2011a\extern\lib\win64\microsoft
../bin7/libflandmark/Release

Creating library C:\Users\renu\AppData\Local\Temp\mex_JwQeKT\templib.x and object C:\Users\renu\AppData\Local\Temp\mex_JwQeKT\templib.exp
flandmark_detector_mex.obj : error LNK2019: unresolved external symbol "int __cdecl flandmark_detect(struct _IplImage *,int *,struct model_struct *,double *,int *)" (?flandmark_detect@@YAHPEAU_IplImage@@PEAHPEAUmodel_struct@@PEAN1@Z) referenced in function mexFunction
C:\Users\renu\Downloads\flandmark-b6237496a6101a1558b118f9f15f6b74bcbb95d7\flandmark-b6237496a6101a1558b118f9f15f6b74bcbb95d7\matlab_toolbox\mex\flandmark_detector.mexw64 : fatal error LNK1120: 1 unresolved externals

C:\PROGRA~1\MATLAB\R2011A\BIN\MEX.PL: Error: Link of 'C:\Users\renu\Downloads\flandmark-b6237496a6101a1558b118f9f15f6b74bcbb95d7\flandmark-b6237496a6101a1558b118f9f15f6b74bcbb95d7\matlab_toolbox\mex\flandmark_detector.mexw64' failed.

??? Error using ==> mex at 208
Unable to complete successfully.

Error in ==> flandmark_compilemex at 79
eval(['mex -O -largeArrayDims ./mex/flandmark_detector_mex.cpp -I../libflandmark/' include libflandmark cvlibs ' -output
../matlab_toolbox/mex/flandmark_detector']);

Please help

@uricamic
Copy link
Owner

Hi, the same problem here, you have to compile the flandmark library itself. Then update the paths specified in the flandmark_compilemex.m script, to the correct paths leading to directories containing the compiled flandmark libraries. Then it should work.

@verkin
Copy link

verkin commented Oct 17, 2013

Hello, Michael!

I can not form a mex-files of your project flandmark (https://github.com/uricamic/flandmark).

I am using MS Visual Studio 2012 and try to compile flandmark_detector.

I get the following error:

1>------ Перестроение всех файлов начато: проект: flandmark_detector, Конфигурация: Release x64 ------
1> Building Custom Rule C:/facial landmark detector/flandmark/matlab_toolbox/mex/CMakeLists.txt
1> CMake does not need to re-run because C:\facial landmark detector\flandmark\build-msvc2012\matlab_toolbox\mex\CMakeFiles\generate.stamp is up-to-date.
1> Building MEX extension C:/facial landmark detector/flandmark/build-msvc2012/matlab_toolbox/mex/flandmark_detector.mexw64
1> Creating library C:\Users\ssv\AppData\Local\Temp\mex_SPtIIw\templib.x and object C:\Users\ssv\AppData\Local\Temp\mex_SPtIIw\templib.exp
1>flandmark_detector_mex.obj : error LNK2019: unresolved external symbol "int __cdecl flandmark_detect(struct _IplImage *,int *,struct model_struct *,double *,int *)" (?flandmark_detect@@YAHPEAU_IplImage@@PEAHPEAUmodel_struct@@PEAN1@Z) referenced in function mexFunction
1>flandmark_detector.mexw64 : fatal error LNK1120: 1 unresolved externals
1>
1>C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL : error : Link of 'flandmark_detector.mexw64' failed.
1>
========== Перестроение всех: успешно: 0, с ошибками: 1, пропущено: 0 ==========

How can you help me?

Sincerely,
Sergei Verkin

@arthahir
Copy link

i have the following error when i compile my flandmark_simple_example.m in matlab
how i need use flandmark in windows help me ps

Undefined function or variable 'flandmark_load_model'.

Error in flandmark_simple_example (line 17)
model = flandmark_load_model('../data/flandmark_model.dat');

@uricamic
Copy link
Owner

Hi @arthahir,

have you compiled the mex files successfully? There should be .mexw64 or .mexw32 (depending on your system & matlab version) files in /matlab_toolbox/mex/ folder. If not, I can provide you pre-compiled version for windows 7 64bit and 64bit MATLAB: http://www.ulozto.net/x23qdRE/flandmarkv107-precompiled-win7-64b-zip?_ga=1.106888643.1736449076.1428859677

I should also say, that flandmark is now considered to be obsolete, it was replaced by CLandmark: https://cmp.felk.cvut.cz/~uricamic/clandmark/
which is faster, more user friendly and without external dependencies (like OpenCV).

@garayli
Copy link

garayli commented Oct 10, 2015

Hi @uricamic,

I need urgently use flandmark library. Since Thursday I work on an installation of flandmark library. However, I could not correctly mex files and install library. So, I get an error like previous users:

Compiling mex-files on Windows platform...
Insufficient number of outputs from right hand side of equal sign to satisfy assignment.

Error in flandmark_compilemex (line 71)
opencv_core = opencv_core.name;

I've even downloaded above file thay you've uploaded, but no any results.

Please help me. I need very urgent help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants