c++ - 库无法链接特定体系结构的可能原因?

标签 c++ ios linker static-libraries crypto++

我一直在努力尝试将我的 iOS 应用与 arm64 库链接。

有问题的库是 Crypto++。我已经尝试了 wiki 中的预编译 fat 库:http://www.cryptopp.com/wiki/IOS_(Command_Line) .我已经尝试自己编译库,但我不断收到以下类型的链接错误:

  "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*, unsigned long, unsigned long)", referenced from:
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libcryptopp.a(randpool.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > std::__1::operator+<char, std::__1::char_traits<char>, std::__1::allocator<char> >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*) in libcryptopp.a(modes.o)

libcryptopp.a 似乎适用于 armv7,但出于某种原因不适用于 arm64。如果我从链接过程中排除 libcryptopp.a 的 64 位版本,它会产生更多错误。

它们都是使用-stdlib=libstdc++编译的

这是怎么回事?

(由于调整开发原因,我需要 arm64 支持)

更新 抱歉 - 事实证明它使用的是旧的 libcryptopp.a,但没有正确找到 libcryptopp.a。 .a 来自其他地方,已修复。

最佳答案

"std::__1::basic_string, std::__1::allocator >::__init(char const*, unsigned long, unsigned long)", referenced from: ... libcryptopp.a(randpool.o)

此库已构建,依赖于 LLVM 的 C++ 运行时 libc++ GNU 的 C++ 运行时 libstdc++

They both were compiled using -stdlib=libstdc++

您需要要么根据libstdc++重建libcryptopp.a-stdlib 链接=libc++(并针对 libc++ 构建其余代码)。


如果有兴趣,__1 是一个用于版本控制的内联命名空间。参见 What are inline namespaces for?Where does the __1 symbol come from when using LLVM's libc++? .

关于c++ - 库无法链接特定体系结构的可能原因?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22110900/

相关文章:

c++ - 如何检查 C++11 支持?

ios - Titanium - 像Groupon一样的滑动菜单

c++ - 如何使用 g++47 允许 -z multidefs

c++ - 使用 MFC 添加两个数字

c++ - 通过引用传递给一个函数,它是一种提升吗?

ios - 当尝试获取应用程序方向时,“statusBarOrientation”在 iOS 13.0 中已被弃用

c - 将 C 代码与 Cuda 代码链接

visual-studio-2010 - VS2010 C++ 项目 : links fine in debug, 中的 NODEFAULTLIB 噩梦无法在发行版中找到一致的库集

c++ - 最简单的传递引用需要什么?

ios - 设置模型类之间的关系