emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#65319: closed (compilation error on Android (Termux))


From: GNU bug Tracking System
Subject: bug#65319: closed (compilation error on Android (Termux))
Date: Wed, 16 Aug 2023 12:34:02 +0000

Your message dated Wed, 16 Aug 2023 20:33:36 +0800
with message-id <87bkf7jhen.fsf@yahoo.com>
and subject line Re: bug#65319: compilation error on Android (Termux)
has caused the debbugs.gnu.org bug report #65319,
regarding compilation error on Android (Termux)
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
65319: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65319
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- 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






--- End Message ---
--- Begin Message --- Subject: Re: bug#65319: compilation error on Android (Termux) Date: Wed, 16 Aug 2023 20:33:36 +0800 User-agent: Gnus/5.13 (Gnus v5.13)
Bruno Haible <bruno@clisp.org> writes:

> Po Lu wrote:
>> Does Gnulib guarantee that the gl_CHECK_FUNCS_ANDROID stuff will
>> continue to exist in the future?  If so, I'm inclined towards using
>> that.
>
> Yes. This macro is used over 100 times in Gnulib, has not seen any
> problem reports in the last 6 months, and is prefixed with 'gl_'
> not '_gl_'. Therefore it's very unlikely to go away.
>
> Note this macro's documentation:
>
> ...
> dnl Thus, the question "does the OS have the function func" has three possible
> dnl answers:
> dnl   - yes, in all versions starting from the given API level,
> dnl   - no, in no version,
> dnl   - not in the given API level, but in a later version of Android.
> ...
> dnl This macro sets two variables:
> dnl   - gl_cv_onwards_func_<func>   to yes / no / "future OS version"
> dnl   - ac_cv_func_<func>           to yes / no / no
> dnl The first variable allows to distinguish all three cases.
> dnl The second variable is set, so that an invocation
> dnl   gl_CHECK_FUNCS_ANDROID([func], [[#include <foo.h>]])
> dnl can be used as a drop-in replacement for
> dnl   AC_CHECK_FUNCS([func]).
>
> Bruno

Thanks.  I'll install the change you proposed in short order, and am
closing this bug.


--- End Message ---

reply via email to

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