bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Patch] Fix build with Android's Bionic for X86


From: Andoni Morales
Subject: [Patch] Fix build with Android's Bionic for X86
Date: Tue, 15 Jan 2013 12:02:36 +0100

Hi,

The attached patch is a proposed fix to fix building gnulib with
Android's Binonic for X86 (this bugs does not appear for ARM
architectures).

In lib/stdint.in.h there is the following fix for Bionic, which
includes the system's stdint.h if time_t is not defined, defined in
included-fixed/sys/types.h:

36 /* On Android (Bionic libc), <sys/types.h> includes this file before
37    having defined 'time_t'.  Therefore in this case avoid including
38    other system header files; just include the system's <stdint.h>.
39    Ideally we should test __BIONIC__ here, but it is only defined after
40    <sys/cdefs.h> has been included; hence test __ANDROID__ instead.  */
41 #if defined __ANDROID__ \
42     && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
43 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
44 #else

But compiling for Android X86, _SSIZE_T_DEFINED_ is already defined
and hence the system's stdint.h is never included. I believe this
check for _SSIZE_T_DEFINED_ is there to check if
included-fixed/sys/types.h was already included but _SSIZE_T_DEFINED_
is not only defined in included-fixed/sys/types.h, it's also defined
in include/machine/_types.h, which is included by stdio.h as shown by
the preprocessor output:

# 26 "progname.c" 2
# 1 "./stdio.h" 1
# 20 "./stdio.h"
.......
# 21 "./stdio.h" 3
# 43 "./stdio.h" 3
# 1 
"/home/andoni/cerbero/android-ndk-r8b/toolchains/x86-4.6/prebuilt/linux-x86/bin/../lib/gcc/i686-linux-android/4.6.x-google/include-fixed/stdio.h"
1 3 4
# 51 
"/home/andoni/cerbero/android-ndk-r8b/toolchains/x86-4.6/prebuilt/linux-x86/bin/../lib/gcc/i686-linux-android/4.6.x-google/include-fixed/stdio.h"
3 4
# 1 
"/home/andoni/cerbero/android-ndk-r8b/platforms/android-9/arch-x86/usr/include/sys/_types.h"
1 3 4
# 40 
"/home/andoni/cerbero/android-ndk-r8b/platforms/android-9/arch-x86/usr/include/sys/_types.h"
3 4
# 1 
"/home/andoni/cerbero/android-ndk-r8b/platforms/android-9/arch-x86/usr/include/machine/_types.h"
1 3 4
# 42 
"/home/andoni/cerbero/android-ndk-r8b/platforms/android-9/arch-x86/usr/include/machine/_types.h"
3 4
typedef unsigned int size_t;
typedef long int ssize_t;

Hence the correct check for included-fixed/sys/types.h h would be to
check against __need_size_t, defined at the beginning of this headers
file.


Cheers,
Andoni

Attachment: 0001-stdint-fix-build-with-Android-s-Bionic-fox-x86.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]