Mex with MATLAB R2014A & Xcode6

2 次查看(过去 30 天)
Vimal
Vimal 2014-9-22
回答: Ken Atwell 2014-9-24
Hi,
I'm currently working on developing algorithms in MATLAB and deploying them on iOS. My set-up includes the following: * MATLAB R2014a * Xcode 6 * Max OS X Mavericks 10.9.5
I have been happily using MATLAB's mex with Xcode 5.x and OS X 10.9.4 previously. I was forced to update to Xcode 6 as my app development work requires me to do that, so rolling back to Xcode 5 is not an option. After the update, I'm unable to use mex to build applications for my work. I'm getting linker errors that I haven't encountered previously. I made changes to mexopts.sh but this hasn't resolved my issue. Can you provide a solution to resolve my issue?
Thanks!
  3 个评论
Sergio
Sergio 2014-9-23
编辑:Sergio 2014-9-23
I'll second that. I now get "stdlib.h" can't be found when trying to run a simulink model in rapid accelerator mode (that uses mex to compile).
I also modified my mexopts.sh and replaced 10.7 sdk with 10.9 to no avail.
Same setup as you Vimal, R2014A, Xcode 6.0.1, OSX 10.9.5
Vimal
Vimal 2014-9-23
Geoff,
Here is the log. Note that I verified using "lipo -info" that all of my opencv libs and the built archive binary ("static" lib) are for x86_64 arch
/Applications/MATLAB_R2014a.app/bin/mex -c -cxx -largeArrayDims -Iinclude -I/usr/local/Cellar/opencv/2.4.9/include/opencv -I/usr/local/Cellar/opencv/2.4.9/include src/MxArray.cpp -outdir lib Building with 'Xcode Clang++'. MEX completed successfully. ar -cq lib/libMxArray.a lib/*.o rm -f -f lib/*.o /Applications/MATLAB_R2014a.app/bin/mex -cxx -largeArrayDims -Iinclude -I/usr/local/Cellar/opencv/2.4.9/include/opencv -I/usr/local/Cellar/opencv/2.4.9/include src/+cv/CamShift.cpp -lMxArray -Llib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_calib3d.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_contrib.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_core.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_features2d.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_flann.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_gpu.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_highgui.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_imgproc.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_legacy.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ml.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_nonfree.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_objdetect.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ocl.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_photo.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_stitching.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_superres.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_ts.a /usr/local/Cellar/opencv/2.4.9/lib/libopencv_video.dylib /usr/local/Cellar/opencv/2.4.9/lib/libopencv_videostab.dylib -output +cv/CamShift.mexmaci64 Building with 'Xcode Clang++'. Undefined symbols for architecture x86_64: "cv::merge(std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> > const&, cv::_OutputArray const&)", referenced from: MxArray::toMat(int, bool) const in libMxArray.a(MxArray.o) "cv::split(cv::Mat const&, std::__1::vector<cv::Mat, std::__1::allocator<cv::Mat> >&)", referenced from: MxArray::MxArray(cv::Mat const&, mxClassID, bool) in libMxArray.a(MxArray.o) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
if true
% code
end

请先登录,再进行评论。

回答(1 个)

Ken Atwell
Ken Atwell 2014-9-24
There is a similar problem (that is, problems with exactly the same OpenCV symbols) reported on Stack Overflow. The solution isn't pretty, but it might be helpful.

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by