尝试在Linux中使用android-ndk-r7交叉编译ICU时,在运行'make'时配置后发生以下错误
__/android-ndk-r7/platforms/android-8/arch-arm/usr/include/sys/types.h:124: error: 'uint64_t' does not name a type
Run Code Online (Sandbox Code Playgroud)
这由icu/source/common/unicode/ptypes.h中的#include <sys/types.h>触发:25.它似乎是android-ndk-n7中的一个非icu问题.在sys/types.h中我们看到
#ifdef __BSD_VISIBLE
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef uint32_t u_int32_t;
typedef uint16_t u_int16_t;
typedef uint8_t u_int8_t;
typedef uint64_t u_int64_t;
#endif
Run Code Online (Sandbox Code Playgroud)
这里的结果是uint64_t,它在sys/types.h顶部的#include <stdint.h>中定义.我们在这里看到
#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
# define __STDC_INT64__
#endif
...
#if defined(__STDC_INT64__)
typedef __int64_t int64_t;
typedef __uint64_t uint64_t;
#endif
Run Code Online (Sandbox Code Playgroud)
如果STRICT_ANSI或STDC_VERSION因此STDC_INT64从不definied,包括SYS/types.h中会抛出一个错误,因为uint64_t中从未定义.以后调用int64_t(在icu代码中发生)和uint64_t的任何代码也会抛出相同的错误.我的临时解决方法是在#include <sys/types.h>之前在icu的ptypes.h顶部定义STDC_INT64.这是一个坏主意吗?