I'm trying to link OpenCV in my iPhone project. I upgraded project made on Xcode3.x for latest Xcode. So I need to link opencv built on Xcode 4.3.
I followed the guide in http://niw.at/articles/2009/03/14/using-opencv-on-iphone/en.
But I meet the link error like below.
Undefined symbols for architecture i386:
"_dgesdd_", referenced from:
cv::_SVDcompute(cv::Mat const&, cv::Mat&, cv::Mat*, cv::Mat*, int) in libopencv_core.a(lapack.o)
"_sgesdd_", referenced from:
cv::_SVDcompute(cv::Mat const&, cv::Mat&, cv::Mat*, cv::Mat*, int) in libopencv_core.a(lapack.o)
"_dpotrf_", referenced from:
cv::solve(cv::Mat const&, cv::Mat const&, cv::Mat&, int) in libopencv_core.a(lapack.o)
cv::invert(cv::Mat const&, cv::Mat&, int) in libopencv_core.a(lapack.o)
......
I wonder I never configured i386 architecture. Please tell me how I can fix this issue.
Oh, I found that I missed Accelerate.framework in Build Phase.
You can add framework in [Project]->[Build Phases]->[Link Binary With Libraries].
Related
lstdc++ is removed from Xcode 10 so I removed this lib from "Link Binary With Libraries" and I added libc++.tbd but I got something like that in linker
Undefined symbols for architecture x86_64:
"std::ios_base::Init::~Init()", referenced from:
__GLOBAL__sub_I_BVMDOfflineMapMerge.cpp in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
"std::string::assign(std::string const&)", referenced from:
_baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
"std::string::_Rep::_S_empty_rep_storage", referenced from:
_baidu_framework::HandleBasemapMerge(_baidu_vi::CVString const&, _baidu_vi::CVString const&, _baidu_vi::CVString const&, char const*) in BaiduMapAPI_Map(BVMDOfflineMapMerge.o)
"std::ostream& std::ostream::_M_insert<unsigned long>(unsigned long)", referenced from:
_baidu_framework::CBVDCVersion::Save() in BaiduMapAPI_Map(BVDEDataCfg.o)
I assue its problem with c++ lib.
maybe ,sdk need update
BaiduMap maybe depend old lib
I'm currently trying to create my own iOS static library, which in turn relies on several static libraries. The overall architecture looks like this:
PersonalSDK
libjpeg.a
opencv2.framework
The PersonalSDK project compiles just fine, and I am able to add PersonalSDK into a sample app (PersonalApp). However, when trying to build PersonalApp, I am getting a whole rash of undefined symbol errors such as:
"cv::copyMakeBorder(cv::_InputArray const&, cv::_OutputArray const&, int, int, int, int, int, cv::Scalar_<double> const&)", referenced from:
Segmenter::segmentize(cv::Rect_<int>&, cv::Mat&, cv::Mat&, cv::Size_<float>&, bool, bool) in personalSDK.a(Segmenter.o)
"cv::findContours(cv::_OutputArray const&, cv::_OutputArray const&, int, int, cv::Point_<int>)", referenced from:
Segmenter::segmentize(cv::Rect_<int>&, cv::Mat&, cv::Mat&, cv::Size_<float>&, bool, bool) in personalSDK.a(Segmenter.o)
Does anyone know how I should go about doing this correctly?
After much trying, I have given up on using static libraries and have gone with using a framework instead!
I import a project cocos2dx into Xcode 5, then build it.
Undefined symbols for architecture i386:
"cocos2d::extension::CocoLoader::ReadCocoBinBuff(char*)", referenced from:
cocos2d::extension::CCDataReaderHelper::addDataFromBinaryCache(char const*, cocos2d::extension::_DataInfo*) in CCDataReaderHelper.o
cocos2d::extension::CCComRender::serialize(void*) in CCComRender.o
cocos2d::extension::GUIReader::widgetFromBinaryFile(char const*) in GUIReader.o
cocos2d::extension::SceneReader::createNodeWithSceneFile(char const*, cocos2d::extension::AttachComponentType) in SceneReader.o
"cocos2d::extension::CocoLoader::CocoLoader()", referenced from:
cocos2d::extension::CCDataReaderHelper::addDataFromBinaryCache(char const*, cocos2d::extension::_DataInfo*) in CCDataReaderHelper.o
cocos2d::extension::CCComRender::serialize(void*) in CCComRender.o
cocos2d::extension::GUIReader::widgetFromBinaryFile(char const*) in GUIReader.o
cocos2d::extension::SceneReader::createNodeWithSceneFile(char const*, cocos2d::extension::AttachComponentType) in SceneReader.o
"cocos2d::extension::CocoLoader::~CocoLoader()", referenced from:
cocos2d::extension::CCDataReaderHelper::addDataFromBinaryCache(char const*, cocos2d::extension::_DataInfo*) in CCDataReaderHelper.o
cocos2d::extension::CCComRender::serialize(void*) in CCComRender.o
cocos2d::extension::GUIReader::widgetFromBinaryFile(char const*) in GUIReader.o
cocos2d::extension::SceneReader::createNodeWithSceneFile(char const*, cocos2d::extension::AttachComponentType) in SceneReader.o
"cocos2d::extension::LabelReader::createInstance()", referenced from:
cocos2d::extension::GUIReader::GUIReader() in GUIReader.o
"cocos2d::extension::ButtonReader::createInstance()", referenced from:
cocos2d::extension::GUIReader::GUIReader() in GUIReader.o
"cocos2d::extension::LayoutReader::createInstance()", referenced from:
cocos2d::extension::GUIReader::GUIReader() in GUIReader.o
"cocos2d::extension::SliderReader::createInstance()", referenced from:
cocos2d::extension::GUIReader::GUIReader() in GUIReader.o
"cocos2d::extension::stExpCocoNode::GetChildNum()", referenced from:
I tried to remove i386 in Valid architechture, but it do not work
I don't know how to fix it. Please help
If your deployment target is 7 then change it to 6
I fixed that issue by going on the target properties of my project and in general tab there's a section called "Linked frameworks and libraries" I added here all the libraries my project uses and that's it, additionally I selected in section "Match-o type" in project properties linking section the option "Static library" also works with "Dynamic library".
I am getting this error which I try to add my OpenCV based library to a MonoTouch project:
Undefined symbols for architecture i386:
"cv::isContourConvex(cv::_InputArray const&)", referenced from:
aruco::MarkerDetector::detectRectangles(cv::Mat const&, std::vector<aruco::MarkerDetector::MarkerCandidate, std::allocator<aruco::MarkerDetector::MarkerCandidate> >&)in libAruco.a(markerdetector.o)
"cv::warpPerspective(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::Size_<int>, int, int, cv::Scalar_<double> const&)", referenced from:
aruco::MarkerDetector::warp_cylinder(cv::Mat&, cv::Mat&, cv::Size_<int>, aruco::MarkerDetector::MarkerCandidate&)in libAruco.a(markerdetector.o)
aruco::MarkerDetector::warp(cv::Mat&, cv::Mat&, cv::Size_<int>, std::vector<cv::Point_<float>, std::allocator<cv::Point_<float> > >)in libAruco.a(markerdetector.o)
"cv::FileNodeIterator::readRaw(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*, unsigned long)", referenced from:
cv::VecReaderProxy<float, 1>::operator()(std::vector<float, std::allocator<float> >&, unsigned long) constin libAruco.a(board.o)
"cv::FileNodeIterator::FileNodeIterator(CvFileStorage const*, CvFileNode const*, unsigned long)", referenced from:
cv::FileNode::begin() constin libAruco.a(board.o)
cv::FileNode::end() constin libAruco.a(board.o)
This is only a sample of the full list of opencv methods which are having this problem, as it is easily over 100.
I'm attempting to run this in the simulator (I only have the trial edition of monotouch). I'm compiling for the ipad simulator in xcode and have followed the Opencv tutorial as far as setting up my project with the pre-built framework from their website. I was maybe wondering if there is some linker flag I need to enter as my static library is not as large as I would expect it to be given the fact it needs to link with several of the opencv modules (that's just a gut feeling and not necessarily indicative of anything).
I suppose its also important to mention that I have very little experience with iOS and MonoTouch development, so I could have missed something really simple.
Your static library might not be a FAT (multiple architectures) library or may not include i386 code.
The easy way to find out is to try, from a terminal window:
lipo -info libAruco.a
That should return something like:
Architectures in the fat file: libAruco.a are: i386 ...
where ... is likely armv7 (or more) to support the iOS devices.
OTOH if i386 is missing then it means your library is not compiled to work on the simulator. In such case you'll need to return to Xcode to build this architecture and use lipo to create a FAT library (that includes both the arm and i386 architectures).
I got some issues as below while try to build Pocket-OCR
Undefined symbols for architecture i386:
"tesseract::TessBaseAPI::SetVariable(char const*, char const*)",
referenced from:
-[OCRDisplayViewController viewDidLoad] in OCRDisplayViewController.o
"tesseract::TessBaseAPI::TesseractRect(unsigned char const*, int, int,
int, int, int, int)", referenced from:
-[OCRDisplayViewController readAndProcessImage:] in OCRDisplayViewController.o
-[OCRDisplayViewController threadedReadAndProcessImage:] in OCRDisplayViewController.o
"tesseract::TessBaseAPI::AllWordConfidences()", referenced from:
-[OCRDisplayViewController viewDidLoad] in OCRDisplayViewController.o "tesseract::TessBaseAPI::End()",
referenced from:
-[OCRDisplayViewController dealloc] in OCRDisplayViewController.o "tesseract::TessBaseAPI::Init(char
const*, char const*, tesseract::OcrEngineMode, char*, int,
GenericVector const, GenericVector const*, bool)",
referenced from:
tesseract::TessBaseAPI::Init(char const*, char const*) in OCRDisplayViewController.o "tesseract::TessBaseAPI::TessBaseAPI()",
referenced from:
-[OCRDisplayViewController viewDidLoad] in OCRDisplayViewController.o ld: symbol(s) not found for architecture
i386 clang: error: linker command failed with exit code 1 (use -v to
see invocation)
What should I do to resolve this issues?
I search on goole for answer but does'n get much help to solve the issues.
you can reference this solution on SO
I got the solution for this and also got new links and examples that are working fine and have completed my demo project
May these links are useful for others who want's to use it.
Example One
Now got the exact link from where I am able to develop my demo project.
Example Which I used
Though the answer is already accepted I found the solution that worked for me:
Apparently xCode does not add frameworks automatically to the "Link Binary With Libraries"- and "Copy Bundle Resources"-lists.
You can find them by clicking on your projectname (blue icon) and then go to "Build Phases" and add them to both lists. Then change from "Required" to "Optional". Both can be seen in the screenshot.