首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >armv7导入C库的未定义体系结构

armv7导入C库的未定义体系结构
EN

Stack Overflow用户
提问于 2015-01-06 22:33:10
回答 1查看 242关注 0票数 1

我试图在我的OpenSSL项目中导入和使用iOS FIPS验证的对象模块。当我构建这个项目时,我会看到这样一个错误:

代码语言:javascript
复制
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被问到并得到了回答。我尝试了所有提到的解决方案,但我无法解决这个问题。

下面是我试图解决问题的一些东西/设置。

  • 我在链接框架和库部分中添加了库库和库库。
  • 因为它是一个库,所以我不需要添加任何.m文件。
  • 我尝试将C++编译器更改为compiler、LLVM、GNU,但它们都没有工作。
  • 我尝试在其他链接器标志中添加-ObjC。
  • 当包含头文件时,我尝试了extern C。头文件的定义也正确地使用了extern C。

更新:

我确实正确地设置了编译器设置,如下所述。

此外,如果这将是任何帮助,以了解这个错误。当在runscript阶段运行这个脚本时,我得到了提到的这些错误。

https://docs.google.com/document/d/1YEebn2p8HKhc7lxUWa3xMHXWt1cELXLm3AoKElbEyuU/edit?usp=sharing

请帮帮我。

Update2 :

xcrun -sdk iphoneos lipo -info隐程序的输出

代码语言:javascript
复制
 Non-fat file : CryptoUtilities.o is architecture: armv7

关于错误的更多细节:REiCquwDXyk/edit?usp=sharing

请帮帮忙。我在这个职位上大约有一个月了。

EN

回答 1

Stack Overflow用户

发布于 2015-01-07 21:18:30

代码语言:javascript
复制
"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++问题,但在这里也适用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27808408

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档