Skip to contentSkip to conversation

package/shellinabox: fix build with musl and GCC >= 14

PATCH In review Yegor Yefremov via buildroot 2 participants 2 messages Nov 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/shellinabox: fix build with musl and GCC >= 14

With musl, shellinabox is configured with --disable-utmp, as required upstream. Its configure then no longer checks for utmp.h, so the header is not included by launcher.c, although login_tty() is still found and used. musl, like glibc, declares login_tty() in utmp.h, and since GCC 14 made implicit function declarations an error, the build fails:

shellinabox/launcher.c:899:5: error: implicit declaration of function 'login_tty' [-Wimplicit-function-declaration]

Add a patch to check for utmp.h even when utmp support is disabled. HAVE_UTMP_H only controls the inclusion of the header, while the login records depend on HAVE_UTMPX_H, which stays undefined.

Upstream has been dead since 2019, so the patch is not sent there.

This issue has been present since commit 5eb0203cb05c ("package/gcc:
add version 14.x"), as GCC 14 turned the implicit declaration into an error. It therefore affects 2024.05 and later, and has occurred more often since GCC 14 became the default in 2025.08.

Fixes:
https://autobuild.buildroot.org/results/5cba7080214ec7af98417db0fb61879d57e313a8

Fixes 5eb0203cb05c0a65bdb7f89a2644eef7cff2dd27 ("package/gcc: add version 14.x")
Assisted-by Claude:claude-opus-5-5
---
 ...ck-for-utmp.h-even-with-disable-utmp.patch | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 package/shellinabox/0003-configure.ac-check-for-utmp.h-even-with-disable-utmp.patch
package/shellinabox/0003-configure.ac-check-for-utmp.h-even-with-disable-utmp.patch new file +49 -0
new file mode 100644
index 0000000000..49012817e9
@@ -0,0 +1,49 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Thu, 19 Nov 2026 10:43:49 +0100
+Subject: [PATCH] configure.ac: check for utmp.h even with --disable-utmp
+
+On Linux, login_tty() is declared in utmp.h. With --disable-utmp,
+which is required with musl, utmp.h is not checked for and thus not
+included, while login_tty() is still found and used by launcher.c. With
+GCC 14 and later, this breaks the build:
+
+  shellinabox/launcher.c:899:5: error: implicit declaration of function 'login_tty' [-Wimplicit-function-declaration]
+
+HAVE_UTMP_H only controls the inclusion of utmp.h, the login records
+depend on HAVE_UTMPX_H. So check for utmp.h unconditionally.
+
+Upstream: dead (last commit in 2019)
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ configure.ac | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 05ab1bb..234ce32 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -34,6 +34,11 @@ dnl Check for header files that do not exist on all platforms
+ AC_CHECK_HEADERS([libutil.h pthread.h pty.h strings.h syslog.h sys/prctl.h \
+                   sys/uio.h util.h])
+ 
++dnl On Linux, login_tty() is declared in utmp.h, so check for it even when
++dnl utmp support is disabled. HAVE_UTMP_H only controls the inclusion of the
++dnl header, the login records themselves depend on HAVE_UTMPX_H.
++AC_CHECK_HEADERS([utmp.h])
++
+ dnl Most systems require linking against libutil.so in order to get login_tty()
+ AC_CHECK_FUNCS(login_tty, [],
+                [AC_CHECK_LIB(util, login_tty,
+@@ -147,7 +152,7 @@ AC_ARG_ENABLE(utmp,
+                                            be disabled.])
+ 
+ if test "x$enable_utmp" != xno; then
+-  AC_CHECK_HEADERS([utmp.h utmpx.h])
++  AC_CHECK_HEADERS([utmpx.h])
+ 
+   dnl Even if utmpx.h exists, not all systems have support for updwtmpx()
+   AC_TRY_LINK([#include <utmp.h>],
+-- 
+2.34.1
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yegor" == Yegor Yefremov via buildroot <[email protected]> writes:

With musl, shellinabox is configured with --disable-utmp, as required upstream. Its configure then no longer checks for utmp.h, so the header is not included by launcher.c, although login_tty() is still found and used. musl, like glibc, declares login_tty() in utmp.h, and since GCC 14 made implicit function declarations an error, the build fails:

Quoted 5 lines

shellinabox/launcher.c:899:5: error: implicit declaration of function 'login_tty' [-Wimplicit-function-declaration]

Add a patch to check for utmp.h even when utmp support is disabled. HAVE_UTMP_H only controls the inclusion of the header, while the login records depend on HAVE_UTMPX_H, which stays undefined.

Committed, thanks.

Quoted 1 line

Upstream has been dead since 2019, so the patch is not sent there.

Perhaps we should remove it then? Oliver?

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot