bug-gnulib
[Top][All Lists]
Advanced

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

fix some build errors on Android 4.3


From: Bruno Haible
Subject: fix some build errors on Android 4.3
Date: Fri, 25 Jan 2019 02:14:54 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; )

On Android 4.3 (native compilation environment, through the 'Terminal IDE'
app), I'm seeing a number of build errors when building testdirs.

I) There is no /bin/sh. The shell is /system/bin/sh and is available through
   $PATH. This causes problems in a couple of places. One of them is that
   all tests that are shell scripts fail with 'Bad interpreter' - because
   the test-driver installed by Automake assumes that all tests are executable,
   but all these shell scripts start with '#!/bin/sh'.

   The fix is to change gnulib-tool to tweak the test-driver, in a way that
   is suitable for gnulib (but not suitable in general).

II) The environment uses a Bionic libc whose headers declare some functions
    which are not present in libc.so.
    (In newer Bionic libcs the declarations are conditionalized depending
    on the Android level.)

1)
terminal-gcc -mandroid -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. 
-I../../gltests -I..  -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. 
-I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib 
-I/data/data/com.spartacusrex.spartacuside/files/local/include -Wall  -g -O2 -c 
-o test-fchownat.o ../../gltests/test-fchownat.c
../../gltests/test-fchownat.c:24: error: 'fchownat' undeclared here (not in a 
function)
make[4]: *** [test-fchownat.o] Error 1

libc.so has fchownat.
It is declared in <sys/stat.h>, not in <unistd.h>.

2)
terminal-gcc -mandroid -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. 
-I../../gltests -I..  -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. 
-I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib 
-I/data/data/com.spartacusrex.spartacuside/files/local/include -Wall  -g -O2 -c 
-o test-renameat.o ../../gltests/test-renameat.c
../../gltests/test-renameat.c:24: error: 'renameat' undeclared here (not in a 
function)
make[4]: *** [test-renameat.o] Error 1

libc.so has renameat.
It is declared in <sys/stat.h>, not in <stdio.h>.

3)
terminal-gcc -mandroid -std=gnu99 -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. 
-I../../gltests -I..  -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. 
-I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib 
-I/data/data/com.spartacusrex.spartacuside/files/local/include -Wall  -g -O2 -c 
-o test-unlinkat.o ../../gltests/test-unlinkat.c
../../gltests/test-unlinkat.c:24: error: 'unlinkat' undeclared here (not in a 
function)
make[4]: *** [test-unlinkat.o] Error 1

libc.so has unlinkat.
It is declared in <fcntl.h>, not in <unistd.h>.

4)
terminal-gcc -mandroid -std=gnu99  -g -O2  
-L/data/data/com.spartacusrex.spartacuside/files/local/lib -o test-fdatasync 
test-fdatasync.o libtests.a ../gllib/libgnu.a libtests.a   
test-fdatasync.o: In function `main':
/data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-fdatasync.c:38:
 undefined reference to `fdatasync'
/data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-fdatasync.c:50:
 undefined reference to `fdatasync'
/data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-fdatasync.c:56:
 undefined reference to `fdatasync'
/data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-fdatasync.c:63:
 undefined reference to `fdatasync'
test-fdatasync.o:(.debug_info+0x2fb): undefined reference to `fdatasync'
collect2: ld returned 1 exit status
make[4]: *** [test-fdatasync] Error 1

libc.so does not have fdatasync.
It is declared in <unistd.h>.

5)
terminal-gcc -mandroid -std=gnu99  -g -O2  
-L/data/data/com.spartacusrex.spartacuside/files/local/lib -o test-wcrtomb 
test-wcrtomb.o libtests.a ../gllib/libgnu.a libtests.a  
test-wcrtomb.o: In function `check_character':
/data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-wcrtomb.c:42:
 undefined reference to `mbtowc'
collect2: ld returned 1 exit status
make[4]: *** [test-wcrtomb] Error 1

libc.so does not have mbtowc.
It is declared in <stdlib.h>.

6)
terminal-gcc -mandroid -std=gnu99  -g -O2  
-L/data/data/com.spartacusrex.spartacuside/files/local/lib -o test-random 
test-random.o libtests.a ../gllib/libgnu.a libtests.a  
test-random.o: In function `main':
/data/data/com.spartacusrex.spartacuside/files/testdir-posix/build/gltests/../../gltests/test-random.c:38:
 undefined reference to `initstate'
test-random.o:(.debug_info+0x37b): undefined reference to `initstate'
test-random.o:(.debug_info+0x3a0): undefined reference to `setstate'
collect2: ld returned 1 exit status
make[4]: *** [test-random] Error 1

libc.so does not have initstate and setstate, but has random and srandom.


All these problems are fixed through the attached patches.

Attachment: 0001-gnulib-tool-Support-running-testdirs-on-Android.patch
Description: Text Data

Attachment: 0002-fchownat-Fix-compilation-error-on-Android-4.3.patch
Description: Text Data

Attachment: 0003-renameat-Fix-compilation-error-on-Android-4.3.patch
Description: Text Data

Attachment: 0004-unlinkat-Fix-compilation-error-on-Android-4.3.patch
Description: Text Data

Attachment: 0005-fdatasync-Fix-compilation-error-on-Android-4.3.patch
Description: Text Data

Attachment: 0006-mbtowc-Fix-compilation-error-on-Android-4.3.patch
Description: Text Data

Attachment: 0007-random-Fix-compilation-error-on-Android-4.3.patch
Description: Text Data


reply via email to

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