title: Compiling ICU for Android - 'uint64_t' does not name a type
body: <p>While attempting to cross-compile ICU using android-ndk-r7 in Linux, the following error occurs after configuration when I run 'make'</p>
  
  <pre><code>__/android-ndk-r7/platforms/android-8/arch-arm/usr/include/sys/types.h:124: error: 'uint64_t' does not name a type
  </code></pre>
  
  <p>This is triggered by the #include &lt;sys/types.h&gt; in icu/source/common/unicode/ptypes.h:25. It appears to be a non-icu issue in android-ndk-n7. In sys/types.h we see </p>
  
  <pre><code>#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
  </code></pre>
  
  <p>The culprint here is uint64_t, which is defined in #include &lt;stdint.h&gt; at the top of the sys/types.h. Here we see</p>
  
  <pre><code>#if !defined __STRICT_ANSI__ || __STDC_VERSION__ &gt;= 199901L
  #  define __STDC_INT64__
  #endif
  
  ...
  
  #if defined(__STDC_INT64__)
  typedef __int64_t     int64_t;
  typedef __uint64_t    uint64_t;
  #endif
  </code></pre>
  
  <p>If <strong>STRICT_ANSI</strong> or <strong>STDC_VERSION</strong> and therefore <strong>STDC_INT64</strong> are never definied, including sys/types.h will throw an error since uint64_t is never defined. Any code that later calls either int64_t (happens in icu code) and uint64_t will also throw the same error. My temporary fix for this is to define <strong>STDC_INT64</strong> at the top of icu's ptypes.h right before #include &lt;sys/types.h&gt;. Is this a bad idea?</p>