android使用arm64-v8a ABI编译错误“未定义引用”

时间:2019-01-18 05:59:50

标签: makefile protocol-buffers cocos2d-x arm64

环境:

protocol buffer: 2.5.0
ndk: android-ndk-r13b
ant: apache-ant-1.9.4
cocos2d-x: 3.12
os: mac 10.12

我已经使用APP_ABI = armeabi-v7a编译很长时间了(来自https://github.com/protocolbuffers/protobuf/releases/tag/v2.5.0的.h和.cc文件),一切正常。

但是最近我必须将arm64-v8a添加到APP_ABI中,并且开始出现以下错误:

stubs/once.h:125: undefined reference to 
google::protobuf::internal::Acquire_Load(long const volatile*)

然后我检查并发现Acquire_Loadstubs/atomicops.h中带有宏:

#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT
// ......
Atomic64 Acquire_Load(volatile const Atomic64* ptr);
// ......
#endif  // GOOGLE_PROTOBUF_ARCH_64_BIT

GOOGLE_PROTOBUF_ARCH_64_BITstubs/platform_macros.h中定义:

#if defined(_M_X64) || defined(__x86_64__)
#define GOOGLE_PROTOBUF_ARCH_X64 1
#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
#elif defined(_M_IX86) || defined(__i386__)
#define GOOGLE_PROTOBUF_ARCH_IA32 1
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#elif defined(__QNX__)
#define GOOGLE_PROTOBUF_ARCH_ARM_QNX 1
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#elif defined(__ARMEL__)
#define GOOGLE_PROTOBUF_ARCH_ARM 1
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#elif defined(__MIPSEL__)
#define GOOGLE_PROTOBUF_ARCH_MIPS 1
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#elif defined(__pnacl__)
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#elif defined(__ppc__)
#define GOOGLE_PROTOBUF_ARCH_PPC 1
#define GOOGLE_PROTOBUF_ARCH_32_BIT 1
#elif defined(__aarch64__)
#define GOOGLE_PROTOBUF_ARCH_ARM 1
#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
#else
#error Host architecture was not detected as supported by protobuf
#endif

我对编译东西不是很熟悉,因此无法弄清楚哪里出了问题。

任何建议将不胜感激,谢谢:)

1 个答案:

答案 0 :(得分:0)

您的ProtoBuf 2版本不支持Arm64 AtomicOps

您可以升级或打补丁以支持它。请检查以下protobuf commit