utmp(x) (cross)compilation error since 2022.82
loginrec.c: In function 'utmpx_perform_login':
loginrec.c:832:31: error: 'ut' undeclared (first use in this function); did you mean 'utx'?
if (!utmpx_write_direct(li, &ut)) {
^~
utx
loginrec.c:832:31: note: each undeclared identifier is reported only once for each function it appears in
Workaround: --disable-utmp --disable-utmpx
What platform is that compiling on?
It's mips with uClibc. The full output: build.txt
I noticed: checking for struct utmpx.ut_syslen... no checking for struct utmpx.ut_addr... no checking for struct utmpx.ut_time... no
Hm, loginrec.c hasn't changed for a long time, and OpenSSH's copy (where it came from) still has the same thing. So I guess that code path doesn't usually get hit. Perhaps something strange is going on with configure. Did it work OK in previous Dropbear versions? I can't think what would have changed.
Forgot to add, which exact toolchain are you using?
This for FritzBox 7590: https://github.com/Freetz-NG/freetz-ng With previous 2020.81 it worked
A diff of the configure output:
-2020.81
+2022.82
-checking for ANSI C header files... (cached) yes
+checking sys/prctl.h usability... yes
+checking sys/prctl.h presence... yes
+checking for sys/prctl.h... yes
-checking whether time.h and sys/time.h may both be included... (cached) yes
-checking if your system defines UTMPX_FILE... no
+checking if your system defines UTMPX_FILE... yes
-checking if your system defines WTMPX_FILE... no
+checking if your system defines WTMPX_FILE... yes
+checking for fexecve... yes
+config.status: creating test/Makefile
So it worked with .81 because wtmpx was not found and thus disabled in dropbear, it was never used. Configure of .82 find the file and enables it and fails.
Is this part of dropbear's "loginrec.c" okay?
static int
utmpx_perform_login(struct logininfo *li)
{
struct utmpx utx;
##### ^^^
construct_utmpx(li, &utx);
# ifdef UTMPX_USE_LIBRARY
if (!utmpx_write_library(li, &utx)) {
##### ^^^
dropbear_log(LOG_WARNING, "utmpx_perform_login: utmp_write_library() failed");
return 0;
}
# else
if (!utmpx_write_direct(li, &ut)) {
##### ^^
dropbear_log(LOG_WARNING, "utmpx_perform_login: utmp_write_direct() failed");
return 0;
}
# endif
return 1;
}
Thats what the error above shows
This was fixed in https://github.com/mkj/dropbear/pull/189
Sorry I'd forgotten about this issue - your comment about configure explains my question why it only started happening.