clang: error: linker command failed with exit code 1 while compiling mex in MATLAB2015b on mac os X 10.13.4
2 views (last 30 days)
Show older comments
Hi. I'm trying to compile a mex file on MAC OS X 10.13.4 using MATLAB 2015b and Xcode 9.3. When executing the command
mex -v volunwarpgradMEX.cpp
I get the following output:
Verbose mode is on.
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:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
... Looking for compiler 'Xcode Clang++' ...
... Looking for environment variable 'DEVELOPER_DIR' ...No.
... 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 'xcode-select -print-path' ...Yes ('/Applications/Xcode.app/Contents/Developer').
... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk' ...No.
... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk' ...No.
... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.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.9.sdk' ...No.
... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk' ...No.
... Looking for folder '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk' ...Yes.
... Executing command 'echo /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk | rev | cut -c1-10 | rev | egrep -oh '[0-9]+\.[0-9]+'' ...Yes ('10.13').
Found installed compiler 'Xcode Clang++'.
Options file details
-------------------------------------------------------------------
Compiler location: /Applications/Xcode.app/Contents/Developer
Options file: /Users/donatas/.matlab/R2015b/mex_C++_maci64.xml
CMDLINE100 : /usr/bin/xcrun -sdk macosx10.13 clang++ -c -DMX_COMPAT_32 -DMATLAB_MEX_FILE -I"/Applications/MATLAB_R2015b.app/extern/include" -I"/Applications/MATLAB_R2015b.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.13 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -fobjc-arc -std=c++11 -stdlib=libc++ -O2 -DNDEBUG /Users/donatas/Documents/SD_scratch/volunwarpgradMEX.cpp -o /var/folders/xs/xx9d6f1x4d7b1hs44z9gs45w0000gn/T//mex_15031778690944_17057/volunwarpgradMEX.o
CMDLINE200 : /usr/bin/xcrun -sdk macosx10.13 clang++ -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.13 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -framework Cocoa -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2015b.app/extern/lib/maci64/mexFunction.map" -stdlib=libc++ -O -Wl,-exported_symbols_list,"/Applications/MATLAB_R2015b.app/extern/lib/maci64/mexFunction.map" /var/folders/xs/xx9d6f1x4d7b1hs44z9gs45w0000gn/T//mex_15031778690944_17057/volunwarpgradMEX.o -L"/Applications/MATLAB_R2015b.app/bin/maci64" -lmx -lmex -lmat -o volunwarpgradMEX.mexmaci64
CMDLINE300 : rm -f /var/folders/xs/xx9d6f1x4d7b1hs44z9gs45w0000gn/T//mex_15031778690944_17057/volunwarpgradMEX.o
CXX : /usr/bin/xcrun -sdk macosx10.13 clang++
DEFINES : -DMX_COMPAT_32 -DMATLAB_MEX_FILE
MATLABMEX : -DMATLAB_MEX_FILE
CXXFLAGS : -fno-common -arch x86_64 -mmacosx-version-min=10.13 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -fobjc-arc -std=c++11 -stdlib=libc++
INCLUDE : -I"/Applications/MATLAB_R2015b.app/extern/include" -I"/Applications/MATLAB_R2015b.app/simulink/include"
CXXOPTIMFLAGS : -O2 -DNDEBUG
CXXDEBUGFLAGS : -g
LDXX : /usr/bin/xcrun -sdk macosx10.13 clang++
LDFLAGS : -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.13 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -framework Cocoa -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2015b.app/extern/lib/maci64/mexFunction.map" -stdlib=libc++
LDBUNDLE : -bundle
LINKEXPORT : -Wl,-exported_symbols_list,"/Applications/MATLAB_R2015b.app/extern/lib/maci64/mexFunction.map"
LINKLIBS : -L"/Applications/MATLAB_R2015b.app/bin/maci64" -lmx -lmex -lmat
LDOPTIMFLAGS : -O
LDDEBUGFLAGS : -g
OBJEXT : .o
LDEXT : .mexmaci64
DEVELOPER_DIR_CHECK :
XCODE_DIR : /Applications/Xcode.app/Contents/Developer
XCRUN_DIR : /usr/bin
ISYSROOT : /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
SDKVER : 10.13
MATLABROOT : /Applications/MATLAB_R2015b.app
ARCH : maci64
SRC : /Users/donatas/Documents/SD_scratch/volunwarpgradMEX.cpp
OBJ : /var/folders/xs/xx9d6f1x4d7b1hs44z9gs45w0000gn/T//mex_15031778690944_17057/volunwarpgradMEX.o
OBJS : /var/folders/xs/xx9d6f1x4d7b1hs44z9gs45w0000gn/T//mex_15031778690944_17057/volunwarpgradMEX.o
SRCROOT : /Users/donatas/Documents/SD_scratch/volunwarpgradMEX
DEF : /var/folders/xs/xx9d6f1x4d7b1hs44z9gs45w0000gn/T//mex_15031778690944_17057/volunwarpgradMEX.def
EXP : volunwarpgradMEX.exp
LIB : volunwarpgradMEX.lib
EXE : volunwarpgradMEX.mexmaci64
ILK : volunwarpgradMEX.ilk
MANIFEST : volunwarpgradMEX.mexmaci64.manifest
TEMPNAME : volunwarpgradMEX
EXEDIR :
EXENAME : volunwarpgradMEX
OPTIM : -O2 -DNDEBUG
LINKOPTIM : -O
-------------------------------------------------------------------
Building with 'Xcode Clang++'.
/usr/bin/xcrun -sdk macosx10.13 clang++ -c -DMX_COMPAT_32 -DMATLAB_MEX_FILE -I"/Applications/MATLAB_R2015b.app/extern/include" -I"/Applications/MATLAB_R2015b.app/simulink/include" -fno-common -arch x86_64 -mmacosx-version-min=10.13 -fexceptions -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -fobjc-arc -std=c++11 -stdlib=libc++ -O2 -DNDEBUG /Users/donatas/Documents/SD_scratch/volunwarpgradMEX.cpp -o /var/folders/xs/xx9d6f1x4d7b1hs44z9gs45w0000gn/T//mex_15031778690944_17057/volunwarpgradMEX.o
/usr/bin/xcrun -sdk macosx10.13 clang++ -Wl,-twolevel_namespace -undefined error -arch x86_64 -mmacosx-version-min=10.13 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -framework Cocoa -bundle -Wl,-exported_symbols_list,"/Applications/MATLAB_R2015b.app/extern/lib/maci64/mexFunction.map" -stdlib=libc++ -O -Wl,-exported_symbols_list,"/Applications/MATLAB_R2015b.app/extern/lib/maci64/mexFunction.map" /var/folders/xs/xx9d6f1x4d7b1hs44z9gs45w0000gn/T//mex_15031778690944_17057/volunwarpgradMEX.o -L"/Applications/MATLAB_R2015b.app/bin/maci64" -lmx -lmex -lmat -o volunwarpgradMEX.mexmaci64
Error using mex
Undefined symbols for architecture x86_64:
"index(int const*, int, int, int)", referenced from:
_mexFunction in volunwarpgradMEX.o
"getvxlval(double const*, int const*, double const*, double const*, int, int, double&)", referenced
from:
getuwlph(double const*, int const*, double const*, double const*, double const*, double const*,
double*) in volunwarpgradMEX.o
getJac(double const*, int, int const*, double const*, double const*, double const*, double const*,
double, double const*, double const*, double const*) in volunwarpgradMEX.o
_mexFunction in volunwarpgradMEX.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas what could have gone wrong? I have files getvxlval.cpp and getvxlval.h in addition to volunwarpgradMEX.cpp that are linked together. The mex file are supposed to be error-free since it was compiled before on a linux platform.
Thank you for any suggestions!
0 Comments
Answers (0)
See Also
Categories
Find more on Troubleshooting in MATLAB Compiler SDK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!