bug-gnulib
[Top][All Lists]
Advanced

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

Re: sys/types.h on Android includes stdint.h before defining time_t


From: Simon Josefsson
Subject: Re: sys/types.h on Android includes stdint.h before defining time_t
Date: Mon, 23 Jan 2012 16:57:22 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.92 (gnu/linux)

Simon Josefsson <address@hidden> writes:

> Bruno Haible <address@hidden> 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:

address@hidden:~$ cat foo.c
#if defined __BIONIC__
#warning foo
#endif
#if defined __ANDROID__
#warning bar
#endif
address@hidden:~$ 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
address@hidden:~$ 

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



reply via email to

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