Comment 4 for bug 1856377

Revision history for this message
Xin Wang (dramwang) wrote :

With following change, and run `make.sh' with `--with-android', there will be no error related to `getdtablesize()':

diff --git a/src/runtime/run-program.c b/src/runtime/run-program.c
index 9be922cd1..00c5b823e 100644
--- a/src/runtime/run-program.c
+++ b/src/runtime/run-program.c
@@ -194,7 +194,7 @@ int spawn(char *program, char *argv[], int sin, int sout, int serr,
         dup2(serr, 2);
     }
     /* Close all other fds. */
-#ifdef SVR4
+#if defined SVR4 || defined LISP_FEATURE_ANDROID
     for (fd = sysconf(_SC_OPEN_MAX)-1; fd >= 3; fd--)
         if (fd != channel[1]) close(fd);
 #else
diff --git a/tools-for-build/ldso-stubs.lisp b/tools-for-build/ldso-stubs.lisp
index d08c620a1..e96196718 100644
--- a/tools-for-build/ldso-stubs.lisp
+++ b/tools-for-build/ldso-stubs.lisp
@@ -250,7 +250,7 @@ ldso_stub__ ## fct: ; \\
                    "fsync"
                    "ftruncate"
                    "getcwd"
- "getdtablesize"
+ #-android "getdtablesize"
                    "getegid"
                    "getenv"
                    "getgid"

And now error messages reduced to:

cc -g -o sbcl alloc.o backtrace.o breakpoint.o coalesce.o coreparse.o dynbind.o
funcall.o gc-common.o globals.o hopscotch.o interr.o interrupt.o largefile.o main.o monitor.o murmur_hash.o os-common.o parse.o print.o purify.o pthread-futex.o regnames.o run-program.o runtime.o safepoint.o save.o sc-offset.o search.o thread.o time.o validate.o var-io.o vars.o wrap.o arm64-arch.o linux-os.o linux-mman.o arm64-linux-os.o fullcgc.o gencgc.o traceroot.o arm64-assem.o ldso-stubs.o -ldl -lm
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: ldso-stubs.o: in function `ldso_stub__dladdr':
/data/data/com.termux/files/home/Live/Lisp/code/sbcl/src/runtime/ldso-stubs.S:124: undefined reference to `wait3'
/data/data/com.termux/files/usr/bin/aarch64-linux-android-ld: warning: creating a DT_TEXTREL in a shared object
clang-9: error: linker command failed with exit code 1 (use -v to see invocation
)
make: *** [GNUmakefile:98: sbcl] Error 1

It is quite confusing, as `wait3' exists in Android, e.g. following code can be compiled:

#include <sys/wait.h>

int main()
{
        wait3(0, 0, 0);
}