我试图在我的OpenSSL项目中导入和使用iOS FIPS验证的对象模块。当我构建这个项目时,我会看到这样一个错误:
Undefined symbols for architecture armv7:
"std::string::clear()", referenced from:
+[CryptoUtilities getSeed:::] in CryptoUtilities.o
+[CryptoUtilities getKey:::] in CryptoUtilities.o
"___cxa_pure_virtual", referenced from:
vtable for WBXML::CWBXMLParser in CWBXMLParser.o
"std::string::substr(unsigned long, unsigned long) const", referenced from:
WBXML::CWBXMLParser::LoadWBXMLHeader(std::string const&, unsigned long, unsigned long&) in CWBXMLParser.o
WBXML::CWBXMLParser::LoadTagContents(WBXML::CTag*, std::string const&, unsigned long, unsigned long&, unsigned short&, bool&) in CWBXMLParser.o
+[CryptoUtilities getKey:::] in CryptoUtilities.o
"operator delete(void*)", referenced from:
__gnu_cxx::new_allocator<WBXML::CTag>::deallocate(WBXML::CTag*, unsigned long) in CTag.o
__gnu_cxx::new_allocator<int>::deallocate(int*, unsigned long) in CryptoUtilities.o
// This goes for some more functions and then
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)我知道这个问题已经在here被问到并得到了回答。我尝试了所有提到的解决方案,但我无法解决这个问题。
下面是我试图解决问题的一些东西/设置。
更新:
我确实正确地设置了编译器设置,如下所述。

此外,如果这将是任何帮助,以了解这个错误。当在runscript阶段运行这个脚本时,我得到了提到的这些错误。
https://docs.google.com/document/d/1YEebn2p8HKhc7lxUWa3xMHXWt1cELXLm3AoKElbEyuU/edit?usp=sharing
请帮帮我。
Update2 :
xcrun -sdk iphoneos lipo -info隐程序的输出
Non-fat file : CryptoUtilities.o is architecture: armv7关于错误的更多细节:REiCquwDXyk/edit?usp=sharing
请帮帮忙。我在这个职位上大约有一个月了。
发布于 2015-01-07 21:18:30
"std::string::clear()", referenced from:
+[CryptoUtilities getSeed:::] in CryptoUtilities.o
+[CryptoUtilities getKey:::] in CryptoUtilities.o
"___cxa_pure_virtual", referenced from:
vtable for WBXML::CWBXMLParser in CWBXMLParser.o
"std::string::substr(unsigned long, unsigned long) const", referenced from:
WBXML::CWBXMLParser::LoadWBXMLHeader(std::string const&, unsigned long, unsigned long&) in CWBXMLParser.o
WBXML::CWBXMLParser::LoadTagContents(WBXML::CTag*, std::string const&, unsigned long, unsigned long&, unsigned short&, bool&) in CWBXMLParser.o
+[CryptoUtilities getKey:::] in CryptoUtilities.o
"operator delete(void*)", referenced from:
__gnu_cxx::new_allocator<WBXML::CTag>::deallocate(WBXML::CTag*, unsigned long) in CTag.o
__gnu_cxx::new_allocator<int>::deallocate(int*, unsigned long) in CryptoUtilities.o这与OpenSSL FIPS对象模块无关。
___cxa_pure_virtual和朋友是C++运行时的一部分。看起来您正在混合和匹配libc++ (由Xcode使用)和libstdc++ (由GNU提供)。
由于Xcode的存在,您应该对任何事情都使用libc++。这意味着您确保-stdlib=libc++在所有命令行上。
如果您不能在任何地方使用libc++,那么您需要在任何地方都使用libstdc++。Xcode设置如下所示:C++标准库

上面的图像用于使用Crypto++ (GNU,而不是Xcode默认值)的libstdc++。虽然这是一个Crypto++问题,但在这里也适用。
https://stackoverflow.com/questions/27808408
复制相似问题