iOS. Can add RN .a libs instead of installing RN environment? - ios

I create AwesomeProject with RN command.
open it with xcode and build success by simulator.
I find RN .a libs under folder 'Debug-iphonesimulator'.
create a new xcode project and add step 3 .a libs.
build success.
after copy RCTRootView alloc initWithBundleURL codes in AppDelegate, xcode build failed (simulator selected) with 154 common errors :
Undefined symbols for architecture x86_64:
"std::__1::system_error::system_error(int, std::__1::error_category
const&, char const*)", referenced from:
folly::throwSystemErrorExplicit(int, char const*) in libReact.a(JSBigString.o) "std::__1::basic_streambuf >::setbuf(char*, long)", referenced from:
vtable for google::base_logging::LogStreamBuf in libReact.a(logging.o)
vtable for std::__1::basic_stringbuf, std::__1::allocator > in
libReact.a(logging.o)
vtable for std::__1::basic_stringbuf, std::__1::allocator > in
libReact.a(JSCHelpers.o)
I wonder if this way works? Is it necessary to install RN environment?

Related

Undefined symbols for architecture arm64: "_OBJC_CLASS_$_FIRMessaging"

Hello I am trying to build a firebase unity project in Xcode, after running pod install
and start building the project I get this error :
Undefined symbols for architecture arm64:
"OBJC_CLASS$_FIRMessaging", referenced from:
objc-class-ref in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
"firebase::ReferenceCountedFutureImpl::CompleteHandle(unsigned long)", referenced from:
void firebase::ReferenceCountedFutureImpl::CompleteInternal<void, void firebase::ReferenceCountedFutureImpl::CompleteInternal(unsigned long, int, char const*)::'lambda'(void*)>(unsigned long, int, char const*, void firebase::ReferenceCountedFutureImpl::CompleteInternal(unsigned long, int, char const*)::'lambda'(void*) const&) in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
"firebase::ReferenceCountedFutureImpl::ReleaseMutexAndRunCallback(unsigned long)", referenced from:
void firebase::ReferenceCountedFutureImpl::CompleteInternal<void, void firebase::ReferenceCountedFutureImpl::CompleteInternal(unsigned long, int, char const*)::'lambda'(void*)>(unsigned long, int, char const*, void firebase::ReferenceCountedFutureImpl::CompleteInternal(unsigned long, int, char const*)::'lambda'(void*) const&) in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
"firebase::util::ClassMethodImplementationCache::ReplaceOrAddMethod(objc_class*, objc_selector*, objc_object* ()(objc_object, objc_selector*, ...), objc_class*, bool)", referenced from:
_FirebaseMessagingHookAppDelegate in libFirebaseCppMessaging.a(messaging_231c52c311096cfce13e67fa91eb9ac5.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
any help?
One thing that you can do is make sure you've added your pod file correctly. Check the syntax is correct and if it's not working at all do a pod deinit, clean your build folder, then reinstall the pod again and run your project.
Making sure there is a link between your target and the file also could be worth looking at. Go to your project manager, select your target, and the link binary with libraries and add your pod file that way.
Xcode unittest build failed with error "Undefined symbols for architecture x86_64"
this helped also when looking around how to solve this. Best of luck.

Undefined symbols for architecture i386: for OpenCV project

I am trying to build this project, but its display below error,
Undefined symbols for architecture i386:
"cv::merge(std::vector<cv::Mat, std::allocator<cv::Mat> > const&, cv::_OutputArray const&)", referenced from:
-[RRMainViewController colorSobelEdge:isVertical:] in RRMainViewController.o
"cv::split(cv::Mat const&, std::vector<cv::Mat, std::allocator<cv::Mat> >&)", referenced from:
-[RRMainViewController colorSobelEdge:isVertical:] in RRMainViewController.o
"cv::Exception::Exception(int, std::string const&, std::string const&, std::string const&, int)", referenced from:
-[RRMainViewController floodFillPostprocess:WithColor:] in RRMainViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have added OpenCV.framework and added this line in .pch file
#ifdef __cplusplus
#import <opencv2/opencv.hpp>
#endif
Added this library in project
libstdc++.6.0.9.dylib
libc++.dylib
libz.1.2.5.dylib
But still got above error.. please help... thanx in advance..
Here is the screenshot for my Build phase
=================================================================
SOLVED
This answer by #karthika has helped me.
Opencv framework or some other files are not added in the build phases. Go to project settings->Build phases->Link binary with libraries and check if opencv exists in the list. Otherwise click on + and add it
Then go in the build phases to compile sources and make sure RRMainViewController.m is present in the list. Otherwise click on + and add it
This answer may help you too: Undefined symbols for architecture i386: _OBJC_CLASS_$_SKPSMTPMessage", referenced from: error

How to build ZeroMQ on Xcode 5+ for iOS?

i am trying to build zmq 4.0.3 for iOS. i followed steps from here
i added two headers zmq.h and zmq_utils.h to copy files in target aggregate build phase (iOS framework). but when i added this framework to other project i got errors -
"std::__1::basic_string,
std::__1::allocator >::find(char const*, unsigned long, unsigned
long) const", referenced from:
zmq::socket_base_t::parse_uri(char const*,
std::__1::basic_string,
std::__1::allocator >&, std::__1::basic_string, std::__1::allocator >&) in
ZeroMQ-iOS(socket_base.o) "std::__1::basic_string, std::__1::allocator >::compare(char
const*) const", referenced from:
now i m confused what happened with .hpp files. i havent added this to anywhere while in compiled source is file witl all files having extension .cpp and .m.
if anyone had build this frame on xcode 5.0 so please give me instructions on how to build it.
how can i remove these linker error?

Cmake: link to iOS library

I've a CMake toolchain that should generate static library to deploy in a suitable client app for a selected platform. Available platform is for now only the iOS, however after running CMake and generate the project (both projects: static library and client are build correctly), Xcode fails to build during the linking process. Strange fact, it's not linking also against basic libraries like “std”.
Here the linking issue:
Undefined symbols for architecture armv7:
"typeinfo for std::codecvt<wchar_t, char, __mbstate_t>", referenced from:
typeinfo for boost::filesystem::detail::utf8_codecvt_facet in boost(utf8_codecvt_facet.o)
"std::codecvt<wchar_t, char, __mbstate_t>::~codecvt()", referenced from:
boost::filesystem::detail::utf8_codecvt_facet::~utf8_codecvt_facet() in boost(utf8_codecvt_facet.o)
boost::filesystem::detail::utf8_codecvt_facet::~utf8_codecvt_facet() in boost(utf8_codecvt_facet.o)
"VTT for std::istream", referenced from:
boost::cpp_regex_traits<char>::toi(char const*&, char const*, int) const in boost(instances.o)
"std::numpunct<char>::id", referenced from:
boost::cpp_regex_traits<char>::toi(char const*&, char const*, int) const in boost(instances.o)
I have created the cmake project as in this sample
somebody has a clue?
Thanks to you all,
I solved by just adding the flag "-stdlib=libc++"(as ComicSansMS suggested, thanks) and command include_directories(${Boost_DIR}) to CMakeLists.txt
thanks
Roberto

compilation error when using boost framework and opencv in ios project

I need to use boost framework in my iOS project. My first mission was getting boost to work for Ios. I tried using this script
http://goodliffe.blogspot.co.uk/2010/09/building-boost-framework-for-ios-iphone.html
but wasn't able to build due to lipo errors (?) and couldn't figure out how to solve it. I looked for a precompiled framework and came accross this project on github:
https://github.com/danomatika/ofxLua
There is an Ios version of boost included in the lib section. So I tried using it in my project
but now when I build my project I am getting these errors:
Undefined symbols for architecture i386:
"vtable for boost::filesystem::detail::utf8_codecvt_facet", referenced from:
(anonymous namespace)::path_locale() in boost(path.o)
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"_inflate", referenced from:
MatlabIO::uncompressVariable(unsigned int&, unsigned int&, unsigned int&, std::vector<char, std::allocator<char> > const&) in MatlabIO.o
"_inflateEnd", referenced from:
MatlabIO::uncompressVariable(unsigned int&, unsigned int&, unsigned int&, std::vector<char, std::allocator<char> > const&) in MatlabIO.o
"_inflateInit_", referenced from:
MatlabIO::uncompressVariable(unsigned int&, unsigned int&, unsigned int&, std::vector<char, std::allocator<char> > const&) in MatlabIO.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I also want to make clear that I installed boost using
sudo port install boost
and under my xcode project I am not linking to /usr/local/include/boost/ or something like that. It seems that it is compiling with incorrect architecture.
Any solution for this? Maybe the framework isn't compiled for Ios? Or is my project not referencing the correct version
You can use the BOOST 1.57.0 with ofxiOSBoost static libraries and headers:
https://github.com/danoli3/ofxiOSBoost
Releases for libc++ (c++11), libstdc++.
All build scripts are in the /scripts folder (updated Peter Goodliffe script)

Resources