我一直在努力尝试将我的 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/