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 Center および File ExchangeCall C++ from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by