This patch series fixes several build failures and test failures seen when compiling gnulib with Bionic libc (Android NDK r10d).
With these patches applied, I was able to compile each module listed by "gnulib-tool --list" except for gnumakefile and non-recursive-gnulib-prefix-hack, for ARM (32-bit) using the android-21 API. I also compile-tested a smaller subset of modules using several other arch/platform combinations: - arm android-9 - x86 android-9 - arm android-21 - x86 android-21 - arm64 android-21 - x86_64 android-21 - arm android-19 - arm android-14 - x86 android-19 - x86 android-14 - mips android-21 - mips android-19 - mips android-14 - mips64 android-21 The subset was: fbufmode fflush fpurge freadable freadahead freading freadptr freadseek fseeko fseterr fwritable fwriting getdtablesize localename getugroups euidaccess linkat net_if signal (plus all dependencies) I then deployed these cross-compiled binaries onto a live Bionic+Debian hybrid system, and ran the following test cases: test-alloca-opt test-areadlinkat test-areadlink test-areadlink-with-size test-binary-io.sh test-chdir test-cloexec test-close test-dirent test-dup2 test-duplocale test-dup test-dup-safer test-environ test-errno test-fbufmode test-fchdir test-fcntl-h test-fcntl test-fdopen test-fflush2.sh test-fflush test-fgetc test-fpurge test-fputc test-freadable test-freadahead.sh test-freading test-fread test-freadptr2.sh test-freadptr.sh test-freadseek.sh test-fseek2.sh test-fseeko2.sh test-fseeko3.sh test-fseeko4.sh test-fseeko.sh test-fseek.sh test-fseterr test-fstatat test-fstat test-ftell2.sh test-ftell3 test-ftello2.sh test-ftello3 test-ftello4.sh test-ftello.sh test-ftell.sh test-fwritable test-fwrite test-fwriting test-getcwd-lgpl test-getdtablesize test-getgroups test-gettimeofday test-ignore-value test-init.sh test-intprops test-inttypes test-langinfo test-linkat test-link test-locale test-localename test-lock test-lseek.sh test-lstat test-malloca test-memchr test-memrchr test-net_if test-openat test-open test-pathmax test-priv-set test-readlinkat test-readlink test-rmdir test-setenv test-signal-h test-statat test-stat test-stdalign test-stdbool test-stddef test-stdint test-stdio test-stdlib test-strerror test-string test-symlinkat test-symlink test-sys_socket test-sys_stat test-sys_time test-sys_types test-sys_uio test-thread_create test-thread_self test-time test-unistd test-unlinkat test-unlink test-unsetenv test-verify test-verify.sh test-wchar Android "make check" results: # TOTAL: 107 # PASS: 103 # SKIP: 2 # XFAIL: 0 # FAIL: 2 # XPASS: 0 # ERROR: 0 .. contents:: :depth: 2 SKIP: test-duplocale ==================== Skipping test: function duplocale not available SKIP: test-getgroups ==================== skipping test: no support for groups FAIL: test-localename ===================== libc: Unable to open connection to debuggerd: Connection refused me)Aborted FAIL: test-verify.sh ==================== compiler didn't detect verification failure 1 compiler didn't detect verification failure 2 compiler didn't detect verification failure 3 compiler didn't detect verification failure 4 compiler didn't detect verification failure 5 test-verify is trying to perform compile-time checks. Since I didn't rebuild NDK to run natively on the ARM target, this failure is expected. test-localename is calling strdup() on a NULL pointer returned by gl_locale_name_thread(), and crashing. From reading gl_locale_name_thread() it seems like NULL is a valid result. Maybe we need to change the test case to "return 77" on systems that are unaware of locales? All 107 tests passed when running the latest gnulib code on an x86_64 Linux PC. Kevin Cernekee (11): Fix FILE struct compatibility with Android API level >= 21 Assume unbroken ungetc() on Android getdtablesize: Fix Android build localename: Fix Android build getugroups: Fix Android build euidaccess: Fix Android build linkat_nofollow: Add fallback case for cross compiling net_if: Handle content-free <net/if.h> system headers signal_h: Fix Android build duplocale: Fix Android build of duplocale-tests getdtablesize: Fix RLIMIT_NOFILE fallback case ChangeLog | 66 +++++++++++++++++++++++++++++++++++++++++ doc/posix-headers/monetary.texi | 2 +- lib/fbufmode.c | 3 +- lib/fflush.c | 12 +++++--- lib/fpurge.c | 6 ++-- lib/freadable.c | 3 +- lib/freadahead.c | 3 +- lib/freading.c | 3 +- lib/freadptr.c | 3 +- lib/freadseek.c | 3 +- lib/fseeko.c | 9 ++++-- lib/fseterr.c | 3 +- lib/fwritable.c | 3 +- lib/fwriting.c | 3 +- lib/getdtablesize.c | 4 +-- lib/getugroups.c | 7 +++-- lib/signal.in.h | 8 +++-- lib/stdio-impl.h | 5 ++-- m4/getdtablesize.m4 | 4 ++- m4/linkat.m4 | 18 +++++++++-- m4/net_if_h.m4 | 3 +- m4/ungetc.m4 | 5 ++-- modules/duplocale-tests | 2 ++ modules/euidaccess | 1 + modules/localename | 1 + tests/test-duplocale.c | 2 +- 26 files changed, 147 insertions(+), 35 deletions(-) -- 2.2.0.rc0.207.ga3a616c