* getpass: Fix compilation error on Android
@ 2023-01-05 16:18 Bruno Haible
0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2023-01-05 16:18 UTC (permalink / raw)
To: bug-gnulib
On Android, I'm seeing this compilation error:
clang -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC -DEXEEXT=\"\" -I. -I../../gllib -I.. -DGNULIB_STRICT_CHECKING=1 -I/data/data/com.termux/files/home/local/include -Wall -fvisibility=hidden -O2 -c -o getpass.o ../../gllib/getpass.c
../../gllib/getpass.c:85:1: error: redefinition of 'getpass'
getpass (const char *prompt)
^
/data/data/com.termux/files/usr/include/unistd.h:419:25: note: previous definition is here
static __inline__ char* getpass(const char* prompt) {
^
1 error generated.
make[3]: *** [Makefile:10690: getpass.o] Error 1
The cause is that Android's <unistd.h> defines getpass() as an inline function.
This should better be avoided.
2023-01-05 Bruno Haible <bruno@clisp.org>
getpass: Fix compilation error on Android.
* m4/getpass.m4 (gl_FUNC_GETPASS): Define NO_INLINE_GETPASS.
* doc/glibc-functions/getpass.texi: Mention the Android problem.
diff --git a/doc/glibc-functions/getpass.texi b/doc/glibc-functions/getpass.texi
index 17f1b2374b..8d2ff847ee 100644
--- a/doc/glibc-functions/getpass.texi
+++ b/doc/glibc-functions/getpass.texi
@@ -22,6 +22,10 @@ Portability problems fixed by either Gnulib module @code{getpass} or @code{getpa
@item
This function is missing on some platforms:
mingw, MSVC 14, Android 9.0.
+@item
+This function cannot be called from plain inline or extern inline functions
+on some platforms:
+Android 13.
@end itemize
Portability problems fixed by Gnulib module @code{getpass-gnu}:
diff --git a/m4/getpass.m4 b/m4/getpass.m4
index 15882712d9..2dce1e0dfe 100644
--- a/m4/getpass.m4
+++ b/m4/getpass.m4
@@ -1,4 +1,4 @@
-# getpass.m4 serial 17
+# getpass.m4 serial 18
dnl Copyright (C) 2002-2003, 2005-2006, 2009-2023 Free Software Foundation,
dnl Inc.
dnl This file is free software; the Free Software Foundation
@@ -13,6 +13,9 @@ AC_DEFUN_ONCE([gl_FUNC_GETPASS],
dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+ dnl Persuade Android <unistd.h> to not define getpass() as an inline function.
+ AC_DEFINE([NO_INLINE_GETPASS], [1], [Define to 1 on Android.])
+
AC_CHECK_FUNCS_ONCE([getpass])
if test $ac_cv_func_getpass = no; then
HAVE_GETPASS=0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-05 17:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 16:18 getpass: Fix compilation error on Android Bruno Haible
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).