Simon Josefsson <si...@josefsson.org> writes: > Bruno Haible <br...@clisp.org> writes: > >> 2) Change stdint.h to just include the system's <stdint.h> when >> __BIONIC__ and _SYS_TYPES_H_ are defined but _SSIZE_T_DEFINED_ is not >> yet defined. >> >> The latter is simpler (does not require to override sys/types.h), so I'm >> applying that. > > Thank you Bruno, I can confirm that it works. I'm now trying to build > more of gnulib for Android, let's see what breaks...
It failed directly in accept4.c with this backtrace: depbase=`echo accept4.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ arm-linux-androideabi-gcc --sysroot /home/jas/android-ndk-r7/platforms/android-14/arch-arm -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC -DEXEEXT=\"\" -I. -I.. -DGNULIB_STRICT_CHECKING=1 -I../intl -fvisibility=hidden -g -O2 -MT accept4.o -MD -MP -MF $depbase.Tpo -c -o accept4.o accept4.c &&\ mv -f $depbase.Tpo $depbase.Po In file included from /home/jas/android-ndk-r7/platforms/android-14/arch-arm/usr/include/sys/time.h:33, from ./sys/time.h:39, from /home/jas/android-ndk-r7/platforms/android-14/arch-arm/usr/include/time.h:32, from ./time.h:40, from ./stdint.h:535, from /home/jas/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3/include-fixed/sys/types.h:43, from ./sys/types.h:28, from ./sys/socket.h:52, from accept4.c:21: /home/jas/android-ndk-r7/platforms/android-14/arch-arm/usr/include/linux/time.h:20: error: expected specifier-qualifier-list before 'time_t' /home/jas/android-ndk-r7/platforms/android-14/arch-arm/usr/include/linux/time.h:26: error: expected specifier-qualifier-list before 'time_t' The reason appears to be that __BIONIC__ isn't defined for this include-path. Indeed, it seems __ANDROID__ may be a better symbol to check for? See this: jas@android:~$ cat foo.c #if defined __BIONIC__ #warning foo #endif #if defined __ANDROID__ #warning bar #endif jas@android:~$ arm-linux-androideabi-gcc --sysroot /home/jas/android-ndk-r7/platforms/android-8/arch-arm -o foo foo.c foo.c:5:2: warning: #warning bar /home/jas/android-ndk-r7/platforms/android-8/arch-arm/usr/lib/crtbegin_dynamic.o: In function `_start': (.text+0x14): undefined reference to `main' collect2: ld returned 1 exit status jas@android:~$ With a patch like the one below, it works. However, maybe the __BIONIC__ test is redundant and should be removed? With this, the majority of gnulib does compile, but there are several compile failures. /Simon diff --git a/lib/stdint.in.h b/lib/stdint.in.h index 591371c..4b156c1 100644 --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -37,7 +37,7 @@ /* On Android (Bionic libc), <sys/types.h> includes this file before having defined 'time_t'. Therefore in this case avoid including other system header files; just include the system's <stdint.h>. */ -#if defined __BIONIC__ \ +#if (defined __BIONIC__ || defined __ANDROID__) \ && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_ # @INCLUDE_NEXT@ @NEXT_STDINT_H@ #else