我使用lipo
和libtool
创建了一个带有来自Poco来源的通用静态C ++库的iOS框架。基本上,我所做的是:
compile Poco for iPhoneOS and iPhoneSimulator
for each architecture:
libtool -static -o libPoco.a libPocoFoundation.a libPocoNet.a libPocoJSON.a
lipo armv6/libPoco.a armv7/libPoco.a i386/libPoco.a -create -output universal/libPoco.a
create a framework from the generated fat library and includes
请查看besport/PocoMobile以获取更多信息。
现在,我尝试在应用程序中使用此框架,一切听起来都不错。但是当我尝试使用Poco中的类时,链接器会从Poco和libstdc ++中吐出未定义的符号:
Undefined symbols for architecture i386:
"Poco::format(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Any const&)", referenced from:
Poco::Logger::warning(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Any const&) in MapStorage.o
"Poco::Message::Message(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Message::Priority)", referenced from:
Poco::Logger::log(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, Poco::Message::Priority) in MapStorage.o
"std::string::c_str() const", referenced from:
Poco::ProcessImpl::launchByForkExecImpl(std::string const&, std::vector<std::string, std::allocator<std::string> > const&, std::string const&, Poco::Pipe*, Poco::Pipe*, Poco::Pipe*, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&) in Poco(Process.o)
Poco::EnvironmentImpl::setImpl(std::string const&, std::string const&) in Poco(Environment.o)
Poco::EnvironmentImpl::hasImpl(std::string const&) in Poco(Environment.o)
Poco::EnvironmentImpl::getImpl(std::string const&) in Poco(Environment.o)
"std::string::empty() const", referenced from:
...
我使用nm
和libtool -info
进行了验证,并且库文件似乎包含正确的函数。如果我不对Poco做任何事情,我在项目中的Objective-C ++文件编译也很好。
libtool -static
可以实际使用.a库吗?我这样做了吗?