My current project is driving me absolutely crazy
The issue is with sdk's that I have added to my project. Such as google ads, parse, Facebook and adcolony.
I added them when I first started my project weeks ago and they worked fine.
Today I opened my project, cleaned it, and I started getting "Lexical or preprocessor issues" for all of the added sdk's.
I removed them all and added them again and the "lexical or preprocessor issues" were gone but were replaced 33 "Apple Mach O Linker Errors"
I have no idea what I have done wrong as nothing has changed. I am using the latest version of all of the sdk's.
As I said the project had been building fine for weeks.
Please help me as this is driving me absolutely crazy!
Also I know that there are quite a few questions on Stack Overflow already with answers that address the mach-O linker Errors but none of them are helping me.
Here is a sample of the errors:
Undefined symbols for architecture arm64:
"std::__throw_bad_alloc()", referenced from:
std::vector<google_breakpadPFC_::DynamicImageRef, std::allocator<google_breakpadPFC_::DynamicImageRef> >::_M_insert_aux(__gnu_cxx::__normal_iterator<google_breakpadPFC_::DynamicImageRef*, std::vector<google_breakpadPFC_::DynamicImageRef, std::allocator<google_breakpadPFC_::DynamicImageRef> > >, google_breakpadPFC_::DynamicImageRef const&) in ParseCrashReporting(dynamic_images.o)
google_breakpadPFC_::DynamicImageRef* std::vector<google_breakpadPFC_::DynamicImageRef, std::allocator<google_breakpadPFC_::DynamicImageRef> >::_M_allocate_and_copy<google_breakpadPFC_::DynamicImageRef*>(unsigned long, google_breakpadPFC_::DynamicImageRef*, google_breakpadPFC_::DynamicImageRef*) in ParseCrashReporting(dynamic_images.o)
"std::string::find_first_not_of(char const*, unsigned long, unsigned long) const", referenced from:
MacStringUtilsPFC_::IntegerValueAtIndex(std::string&, unsigned int) in ParseCrashReporting(string_utilities.o)
"std::string::substr(unsigned long, unsigned long) const", referenced from:
MacStringUtilsPFC_::IntegerValueAtIndex(std::string&, unsigned int) in ParseCrashReporting(string_utilities.o)
"std::string::find_first_of(char const*, unsigned long, unsigned long) const", referenced from:
MacStringUtilsPFC_::IntegerValueAtIndex(std::string&, unsigned int) in ParseCrashReporting(string_utilities.o)
"vtable for __cxxabiv1::__si_class_type_info", referenced from:
typeinfo for google_breakpadPFC_::IosExceptionMinidumpGeneratorPFC_ in ParseCrashReporting(ios_exception_minidump_generator.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
I had the same problem a few years ago. It is caused by leaving "Copy items into destination's group folder (if needed)" checked when adding a framework. This option tells Xcode to copy the files you are adding into your project directory. This is good for resources such as images, sounds, and so on since it keeps your whole project in one place instead of scattered all over the computer, but if you do this with a framework you will confuse the prepeocessor and/or linkers because it messes up search paths.
Related
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".
In our project we use library that use libc++ in its implementation very tightly. And when we added Google Maps SDK we got linkage error:
Undefined symbols for architecture i386:
"std::string::_Rep::_M_destroy(std::allocator<char> const&)", referenced from:
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
_GMS_objc_lookUpClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getProtocol in GoogleMaps(GMSRenames.o)
gmscore::vector::CameraPosition::StringValue() const in GoogleMaps(CameraPosition.o)
"std::string::_Rep::_S_empty_rep_storage", referenced from:
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
_GMS_objc_lookUpClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getProtocol in GoogleMaps(GMSRenames.o)
gmscore::vector::CameraPosition::StringValue() const in GoogleMaps(CameraPosition.o)
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
_GMS_objc_lookUpClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getProtocol in GoogleMaps(GMSRenames.o)
gmscore::vector::CameraPosition::StringValue() const in GoogleMaps(CameraPosition.o)
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
_GMS_objc_lookUpClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getClass in GoogleMaps(GMSRenames.o)
_GMS_objc_getProtocol in GoogleMaps(GMSRenames.o)
gmscore::vector::CameraPosition::StringValue() const in GoogleMaps(CameraPosition.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
gmscore::model::Point2D::StringValue() const in GoogleMaps(Point2D.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)", referenced from:
gmscore::utils::gmsutils::StringPrintf(char const*, ...) in GoogleMaps(GMSUtils.o)
gmscore::vector::CameraPosition::StringValue() const in GoogleMaps(CameraPosition.o)
It's happened because google maps sdk use libstdc++ library, but we can not change code which use libc++. We tried to encapsulate code and library which use libc++ in static library (*.a), but without success.
Any chance to make things work? Maybe, it's possible to link Google Maps SDK with libc++?
The undefined symbols you are seeing are symbols associated with libstdc++. libstdc++ and libc++ are largely ABI incompatible, even though they present to you (largely) the same API.
In places where the ABI incompatibility is known, such as std::string, libc++ uses a different mangling scheme so that libstdc++ and libc++ strings are not accidentally mixed at run time (which would cause hard-to-debug run time errors).
If you see symbols that have std::__1 in their name, then those are symbols associated libc++, e.g. libc++ has std::__1::basic_string<..., where as libstdc++ has std::basic_string<....
You can use this knowledge of mangling to help you determine which libraries are needing which implementations of the std::lib.
Filing the feature request you did was the very best thing you could do, and thank you for doing that! :-)
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.
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].