Mex with MATLAB R2014A & Xcode6

2 views (last 30 days)
Vimal
Vimal on 22 Sep 2014
Answered: Ken Atwell on 24 Sep 2014
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 Comments
Sergio
Sergio on 23 Sep 2014
Edited: Sergio on 23 Sep 2014
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 on 23 Sep 2014
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

Sign in to comment.

Answers (1)

Ken Atwell
Ken Atwell on 24 Sep 2014
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.

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!