필터 지우기
필터 지우기

mex file error on mac, works on windows

조회 수: 7 (최근 30일)
t
t 2013년 2월 26일
댓글: XI ZHOU 2018년 4월 2일
I have downloaded a script and it works on a windows pc but on my macbook air (OSX10.8, matlab 2012b, xcode 4.6 with patch) it just won't work. Running the script does this:
Invalid MEX-file '/Users/Till/Documents/Arbeit/Forschung/Matlab/EVM_Matlab/matlabPyrTools/corrDn.mexmaci64':
dlopen(/Users/Till/Documents/Arbeit/Forschung/Matlab/EVM_Matlab/matlabPyrTools/corrDn.mexmaci64, 1): no suitable image found. Did
find:
/Users/Till/Documents/Arbeit/Forschung/Matlab/EVM_Matlab/matlabPyrTools/corrDn.mexmaci64: file too short
*Compiling the .c file:*
>> mex -v corrDn.c
**************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/techdoc/matlab_external/bsflnue-1.html
**************************************************************************
-> mexopts.sh sourced from directory (DIR = $PREF_DIR)
FILE = /Users/Till/.matlab/R2012b/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /Applications/MATLAB_R2012b.app
-> CC = llvm-gcc-4.2
-> CC flags:
CFLAGS = -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/ -mmacosx-version-min=10.5 -fexceptions
CDEBUGFLAGS = -g
COPTIMFLAGS = -O2 -DNDEBUG
CLIBS = -L/Applications/MATLAB_R2012b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = llvm-g++-4.2
-> CXX flags:
CXXFLAGS = -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/ -mmacosx-version-min=10.5
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O2 -DNDEBUG
CXXLIBS = -L/Applications/MATLAB_R2012b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fexceptions -m64 -fbackslash
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O
FLIBS = -L/Applications/MATLAB_R2012b.app/bin/maci64 -lmx -lmex -lmat -L -lgfortran -L -lgfortranbegin
arguments = -DMX_COMPAT_32
-> LD = llvm-gcc-4.2
-> Link flags:
LDFLAGS = -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/ -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2012b.app/extern/lib/maci64/mexFunction.map
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexmaci64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------
-> llvm-gcc-4.2 -c -I/Applications/MATLAB_R2012b.app/extern/include -I/Applications/MATLAB_R2012b.app/simulink/include -DMATLAB_MEX_FILE -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/ -mmacosx-version-min=10.5 -fexceptions -DMX_COMPAT_32 -O2 -DNDEBUG "corrDn.c"
-> llvm-gcc-4.2 -O -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/ -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2012b.app/extern/lib/maci64/mexFunction.map -o "corrDn.mexmaci64" corrDn.o -L/Applications/MATLAB_R2012b.app/bin/maci64 -lmx -lmex -lmat -lstdc++
Undefined symbols for architecture x86_64:
"_internal_reduce", referenced from:
_mexFunction in corrDn.o
"_internal_wrap_reduce", referenced from:
_mexFunction in corrDn.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
mex: link of ' "corrDn.mexmaci64"' failed.
Error using mex (line 206)
Unable to complete successfully.
  • I am definitely not an expert on this and I am lost! Any ideas for help?
Thanks in advance! ti*

채택된 답변

Jan
Jan 2013년 2월 26일
The file corrDn.c calls the functions "internal_reduce" and "internal_wrap_reduce", but the corresponding function definitions are not found. Either they are located in another C-file, and then both C-files must appear in the arguments of the mex command. Or you do not have the corresponding files and asking the author is the best idea.

추가 답변 (2개)

TAB
TAB 2013년 2월 26일
편집: TAB 2013년 2월 26일
mex files are compiled binary code which are platform dependent. A mex file compiled for windows platform will not work on other.
  댓글 수: 2
Walter Roberson
Walter Roberson 2013년 2월 26일
The trace above showed that building the mex failed:
Undefined symbols for architecture x86_64:
"_internal_reduce", referenced from:
_mexFunction in corrDn.o
"_internal_wrap_reduce", referenced from:
_mexFunction in corrDn.o
t
t 2013년 2월 26일
I can compile the .c file but not link it. How do I do that? mex...?

댓글을 달려면 로그인하십시오.


t
t 2013년 3월 5일
Thanks, I finally got it...!
  댓글 수: 2
Hugo Sanabria
Hugo Sanabria 2014년 6월 12일
Would you mind sharing how you solve it? I have a similar problem.
XI ZHOU
XI ZHOU 2018년 4월 2일
To Hugo: I have the same problem as above. What Jan said is right. The command "internal_reduce" and "internal_wrap_reduce" are functions defined in other C-files. So we need to call them in the code. Here is my code:
mex -compatibleArrayDims corrDN.c convolve.c edges.c wrap.c
The command "internal_reduce" is defined in the file 'convolve.c', and the command "internal_wrap_reduce" is defined in the file 'wrap.c'. Another command in 'convolve.c' is defined in the 'edges.c'. That is why I added the three C-files in the code (they are all in the same directory). Then the problem should be fixed.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Call C++ from MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by