GNU bug report logs - #65319
compilation error on Android (Termux)

Previous Next

Package: emacs;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Tue, 15 Aug 2023 20:29:02 UTC

Severity: normal

Done: Po Lu <luangruo <at> yahoo.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Bruno Haible <bruno <at> clisp.org>
To: bug-gnu-emacs <at> gnu.org, Po Lu <luangruo <at> yahoo.com>
Subject: compilation error on Android (Termux)
Date: Tue, 15 Aug 2023 22:28:25 +0200
Hi,

Compiling a current Emacs checkout from today on Android, inside the Termux
app, produces a compilation error:

../../src/dired.c:1140:16: warning: call to undeclared function 'getpwent'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  while ((pw = getpwent ()))
               ^
../../src/dired.c:1140:14: error: incompatible integer to pointer conversion assigning to 'struct passwd *' from 'int' [-Wint-conversion]
  while ((pw = getpwent ()))
             ^ ~~~~~~~~~~~

The reason is that the default Android API level in Termux is 24,
the Android <pwd.h> declares getpwent() only starting with API level 26:

  #if __ANDROID_API__ >= 26
  struct passwd* getpwent(void) __INTRODUCED_IN(26);
  ...

yet HAVE_GETPWENT and HAVE_ENDPWENT come out as 1.

I can see two possible fixes:
  a) use
       gl_CHECK_FUNCS_ANDROID([getpwent], [[#include <pwd.h>]])
     instead of
       AC_CHECK_FUNCS(... getpwent ...)
     in configure.ac,
  b) add
       AC_CHECK_DECLS([getpwent], [], [], [[
         #include <sys/types.h>
         #include <pwd.h>
         ]])
     to configure.ac, and a '&& HAVE_DECL_GETPWENT' in
     src/dired.c line 1137.

Bruno







This bug report was last modified 1 year and 336 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.