Kamis, 14 Mei 2015

[error] Couldn't find mex-file.

I'm working on a project using matlab version R2009b and using isptoolbox that required mex, it solved by installing mingw and gnumex to running the isptoolbox.
I got this error while i upgrade my windows7 from 32bit to 64bit










Error:
mex -v isp_ifptrack_helper.c
 This is mex, Copyright 1984-2007 The MathWorks, Inc. 
 
-> Default options filename found in C:\Users\DELL\AppData\Roaming\MathWorks\MATLAB\R2009b 
---------------------------------------------------------------- 
->    Options file           = C:\Users\DELL\AppData\Roaming\MathWorks\MATLAB\R2009b\mexopts.bat 
      MATLAB                 = C:\PROGRA~1\MATLAB\R2009b 
->    COMPILER               = gcc 
->    Compiler flags: 
         COMPFLAGS           = -c -DMATLAB_MEX_FILE 
         OPTIMFLAGS          = -O3 
         DEBUGFLAGS          = -g 
         arguments           =  
         Name switch         = -o 
->    Pre-linking commands   =  
->    LINKER                 = C:\PROGRA~1\MATLAB\R2009b\sys\perl\win32\bin\perl.exe C:\users\dell\DOCUME~1\matlab\trunk\linkmex.pl 
->    Link directives: 
         LINKFLAGS           =  -LC:\Users\DELL\AppData\Roaming\MATHWO~1\MATLAB\R2009b\gnumex 
         LINKDEBUGFLAGS      = -g  -Wl,--image-base,0x28000000\n 
         LINKFLAGSPOST       =  
         Name directive      = -o isp_ifptrack_helper.mexw64 
         File link directive =  
         Lib. link directive =  
         Rsp file indicator  =  
->    Resource Compiler      = C:\PROGRA~1\MATLAB\R2009b\sys\perl\win32\bin\perl.exe C:\users\dell\DOCUME~1\matlab\trunk\rccompile.pl  -o mexversion.res 
->    Resource Linker        =  
---------------------------------------------------------------- 
 
 
--> gcc  -c -DMATLAB_MEX_FILE -oC:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj -IC:\PROGRA~1\MATLAB\R2009b\extern\include -IC:\PROGRA~1\MATLAB\R2009b\simulink\include -O3 -DMX_COMPAT_32 isp_ifptrack_helper.c 
 
 
--> C:\PROGRA~1\MATLAB\R2009b\sys\perl\win32\bin\perl.exe C:\users\dell\DOCUME~1\matlab\trunk\linkmex.pl -o isp_ifptrack_helper.mexw64  -LC:\Users\DELL\AppData\Roaming\MATHWO~1\MATLAB\R2009b\gnumex -s  C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj   
 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x37a): undefined reference to `mexErrMsgTxt' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x390): undefined reference to `mexErrMsgTxt' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x39a): undefined reference to `mxGetPr' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x3a8): undefined reference to `mxGetM' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x3b4): undefined reference to `mxGetN' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x3c1): undefined reference to `mxGetPr' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x3d0): undefined reference to `mxGetPi' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x3df): undefined reference to `mxGetM' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x3f3): undefined reference to `mexErrMsgTxt' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x3fe): undefined reference to `mxGetScalar' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x40d): undefined reference to `mxGetScalar' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x41c): undefined reference to `mxGetScalar' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x42b): undefined reference to `mxGetScalar' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x43a): undefined reference to `mxGetScalar' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x452): undefined reference to `mxCreateDoubleMatrix_700' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x468): undefined reference to `mxCreateDoubleMatrix_700' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x475): undefined reference to `mxGetPr' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x482): undefined reference to `mxGetPr' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x4fd): undefined reference to `mxGetN' 
C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj:isp_ifptrack_helper.c:(.text+0x520): undefined reference to `mexErrMsgTxt' 
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj: bad reloc address 0x20 in section `.eh_frame' 
collect2.exe: error: ld returned 1 exit status 
link command: gcc -shared C:\Users\DELL\AppData\Roaming\MATHWO~1\MATLAB\R2009b\gnumex\mex.def -o isp_ifptrack_helper.mexw64 -LC:\Users\DELL\AppData\Roaming\MATHWO~1\MATLAB\R2009b\gnumex -s C:\USERS\DELL\APPDATA\LOCAL\TEMP\MEX_18~1\isp_ifptrack_helper.obj -llibmx -llibmex -llibmat 
 
  C:\PROGRA~1\MATLAB\R2009B\BIN\MEX.PL: Error: Link of 'isp_ifptrack_helper.mexw64' failed. 
 
??? Error using ==> mex at 221
Unable to complete successfully.
solution:
  1. Install cygwin, search mingw64 and mark the mingw64 x86_64 gcc core module 
  2. replace mexopt.bat with: https://gist.github.com/1579415
source: https://dgleich.wordpress.com/2012/01/08/compiling-mex-files-with-mingw64/