* bug#65319: compilation error on Android (Termux)
@ 2023-08-15 20:28 Bruno Haible
2023-08-16 1:35 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 6+ messages in thread
From: Bruno Haible @ 2023-08-15 20:28 UTC (permalink / raw)
To: 65319, luangruo
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#65319: compilation error on Android (Termux)
2023-08-15 20:28 bug#65319: compilation error on Android (Termux) Bruno Haible
@ 2023-08-16 1:35 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-08-16 1:49 ` Bruno Haible
0 siblings, 1 reply; 6+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-16 1:35 UTC (permalink / raw)
To: Bruno Haible; +Cc: 65319
Bruno Haible <bruno@clisp.org> writes:
> 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
Thanks. What does config.guess say in Termux? And are you trying to
build the Android port on Android, or just Emacs itself?
P.S: our bug tracker intercepts all mail and resends individual messages
itself, so you must use the X-Debbugs-Cc header instead of the carbon
copy list when initially opening a bug. If you don't, I get the message
you send to the bug tracker, instead of the message it resends.
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#65319: compilation error on Android (Termux)
2023-08-16 1:35 ` 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
0 siblings, 1 reply; 6+ messages in thread
From: Bruno Haible @ 2023-08-16 1:49 UTC (permalink / raw)
To: Po Lu; +Cc: 65319
Po Lu wrote:
> What does config.guess say in Termux?
Both build-aux/config.guess and exec/config.guess return
armv7l-unknown-linux-gnueabi
but I configure all packages with
--host=armv7l-linux-androideabi
so that all tests of "$host_os" see that it's Android and not an
arm system with glibc.
> And are you trying to
> build the Android port on Android, or just Emacs itself?
I took the Emacs sources from git, generated the 'configure' file, and
am compiling it like I compile on other POSIX-like systems. The Emacs
specific configure options that I use are --without-all --without-x.
Bruno
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#65319: compilation error on Android (Termux)
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
0 siblings, 1 reply; 6+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-16 3:15 UTC (permalink / raw)
To: Bruno Haible; +Cc: 65319
Bruno Haible <bruno@clisp.org> writes:
> I took the Emacs sources from git, generated the 'configure' file, and
> am compiling it like I compile on other POSIX-like systems. The Emacs
> specific configure options that I use are --without-all --without-x.
OK, thanks; I'm surprised this configuration functions at all,
considering that it has never been tested.
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#65319: compilation error on Android (Termux)
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
0 siblings, 1 reply; 6+ messages in thread
From: Bruno Haible @ 2023-08-16 9:50 UTC (permalink / raw)
To: Po Lu; +Cc: 65319
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#65319: compilation error on Android (Termux)
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
0 siblings, 0 replies; 6+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-16 12:33 UTC (permalink / raw)
To: Bruno Haible; +Cc: 65319-done
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-08-16 12:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-15 20:28 bug#65319: compilation error on Android (Termux) Bruno Haible
2023-08-16 1:35 ` 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
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).