unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: 65319@debbugs.gnu.org, luangruo@yahoo.com
Subject: bug#65319: compilation error on Android (Termux)
Date: Tue, 15 Aug 2023 22:28:25 +0200	[thread overview]
Message-ID: <7932888.4pN7iFggcO@nimes> (raw)

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








             reply	other threads:[~2023-08-15 20:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 20:28 Bruno Haible [this message]
2023-08-16  1:35 ` bug#65319: compilation error on Android (Termux) Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-16  1:49   ` Bruno Haible
2023-08-16  3:15     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-16  9:50       ` Bruno Haible
2023-08-16 12:33         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7932888.4pN7iFggcO@nimes \
    --to=bruno@clisp.org \
    --cc=65319@debbugs.gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).