From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Cc: Po Lu <luangruo@yahoo.com>
Subject: Re: Android NDK r26 and utmpx
Date: Sun, 21 Jan 2024 17:54:48 +0100 [thread overview]
Message-ID: <3081522.M6yMPqc0BA@nimes> (raw)
In-Reply-To: <87v87ntq4m.fsf@yahoo.com>
Hi Po Lu,
> utmpx.h is provided by this new release of the Android NDK, defining
> functions as nonfunctional as utmp.h does.
So, HAVE_UTMPX_H now is 1.
And utmpname exists but utmpxname does not exist. Therefore UTMP_NAME_FUNCTION
is no longer defined.
> The more pressing problem is that its presence suppresses the definition
> of UTMP_NAME_FUNCTION when a program is built with an __ANDROID_API__
> lower than 34, where the utmpx* series of functions were introduced,
> because the conditional for HAVE_UTMPX_H in readutmp.h does not search
> for a `utmpname' function if `utmpxname' is unavailable, with the result
> that get_android_boot_time is never invoked. Here are the relevant
> portions of config.log:
>
> configure:9462: checking for utmpx.h
> configure:9462: /opt/android/ndk/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android22-clang -c -O2 -g3 -Werror=implicit-function-declaration conftest.c >&5
> configure:9462: $? = 0
> configure:9462: result: yes
>
> configure:16416: /opt/android/ndk/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android22-clang -o conftest -O2 -g3 -Werror=implicit-function-declaration conftest.c >&5
> ld.lld: error: undefined symbol: utmpxname
> >>> referenced by conftest.c:116
> >>> /tmp/conftest-c4f4cf.o:(main)
> >>> did you mean: utmpname
> >>> defined in: /opt/android/ndk/android-ndk-r26/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/22/libc.so
>
> I will install a workaround in Emacs, but it ought to be fixed at the
> source.
This patch should fix it, in the simplest possible way. Committing it.
2024-01-21 Bruno Haible <bruno@clisp.org>
readutmp, boot-time: Port to Android NDK r26.
Reported by Po Lu <luangruo@yahoo.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-01/msg00063.html>.
* lib/readutmp.h: Update comments.
(UTMP_NAME_FUNCTION): Define as a no-op for Android with HAVE_UTMPX_H.
diff --git a/lib/readutmp.h b/lib/readutmp.h
index b62eb3beaa..dcfd44dbbc 100644
--- a/lib/readutmp.h
+++ b/lib/readutmp.h
@@ -114,21 +114,21 @@ enum { UT_HOST_SIZE = -1 };
Field Type Platforms
---------- ------ ---------
- ⎡ ut_user char[] glibc, musl, macOS, FreeBSD, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ⎡ ut_user char[] glibc, musl, macOS, FreeBSD, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
⎣ ut_name char[] NetBSD, Minix
- ut_id char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
- ut_line char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
- ut_pid pid_t glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
- ut_type short glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
- ⎡ ut_tv struct glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
+ ut_id char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ut_line char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ut_pid pid_t glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ut_type short glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ⎡ ut_tv struct glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
⎢ { tv_sec; tv_usec; }
⎣ ut_time time_t Cygwin
- ut_host char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin
- ut_exit struct glibc, musl, NetBSD, Minix, HP-UX, IRIX, Solaris
+ ut_host char[] glibc, musl, macOS, FreeBSD, NetBSD, Minix, AIX, HP-UX, IRIX, Solaris, Cygwin, Android
+ ut_exit struct glibc, musl, NetBSD, Minix, HP-UX, IRIX, Solaris, Android
{ e_termination; e_exit; }
- ut_session [long] int glibc, musl, NetBSD, Minix, IRIX, Solaris
+ ut_session [long] int glibc, musl, NetBSD, Minix, IRIX, Solaris, Android
⎡ ut_addr [long] int HP-UX, Cygwin
- ⎢ ut_addr_v6 [u]int[4] glibc, musl
+ ⎢ ut_addr_v6 [u]int[4] glibc, musl, Android
⎣ ut_ss struct sockaddr_storage NetBSD, Minix
*/
@@ -177,6 +177,10 @@ struct utmpx32
# define UTMP_NAME_FUNCTION utmpxname
# elif defined UTXDB_ACTIVE /* FreeBSD */
# define UTMP_NAME_FUNCTION(x) setutxdb (UTXDB_ACTIVE, x)
+# elif defined __ANDROID__ /* Android */
+/* As of Android NDK r26, the getutxent, setutxent functions are no-ops.
+ Therefore we can ignore the file name. */
+# define UTMP_NAME_FUNCTION(x) ((void) (x))
# endif
#elif HAVE_UTMP_H
prev parent reply other threads:[~2024-01-21 16:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87v87ntq4m.fsf.ref@yahoo.com>
2024-01-21 1:46 ` Android NDK r26 and utmpx Po Lu
2024-01-21 3:04 ` Paul Eggert
2024-01-21 3:38 ` Po Lu
2024-01-21 4:04 ` Paul Eggert
2024-01-21 5:11 ` Po Lu
2024-01-21 16:54 ` Bruno Haible [this message]
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://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3081522.M6yMPqc0BA@nimes \
--to=bruno@clisp.org \
--cc=bug-gnulib@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.
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).