[3.3.17] Build failure with musl (version 1.2.2)
3.3.17 fails to build on a musl based system with the following error:
x86_64-pc-linux-musl-cc -std=gnu99 -DHAVE_CONFIG_H -I. -include ./config.h -I. -I./include -Wno-unused-result -DLOCALEDIR=\"/usr/share/locale\" -march=x86-64 -mtune=generic -pipe -O2 -Iproc -march=x86-64 -mtune=generic -pipe -O2 -c -o w.o w.c
w.c: In function 'print_from':
w.c:76:22: error: '__UT_HOSTSIZE' undeclared (first use in this function); did you mean 'UT_HOSTSIZE'?
76 | # define UT_HOSTSIZE __UT_HOSTSIZE
| ^~~~~~~~~~~~~
w.c:236:43: note: in expansion of macro 'UT_HOSTSIZE'
236 | print_display_or_interface(u->ut_host, UT_HOSTSIZE, fromlen - len);
| ^~~~~~~~~~~
w.c:76:22: note: each undeclared identifier is reported only once for each function it appears in
76 | # define UT_HOSTSIZE __UT_HOSTSIZE
| ^~~~~~~~~~~~~
w.c:236:43: note: in expansion of macro 'UT_HOSTSIZE'
236 | print_display_or_interface(u->ut_host, UT_HOSTSIZE, fromlen - len);
| ^~~~~~~~~~~
w.c: In function 'getproc':
w.c:78:22: error: '__UT_NAMESIZE' undeclared (first use in this function); did you mean 'UT_NAMESIZE'?
78 | # define UT_NAMESIZE __UT_NAMESIZE
| ^~~~~~~~~~~~~
w.c:357:12: note: in expansion of macro 'UT_NAMESIZE'
357 | char buf[UT_NAMESIZE + 1];
| ^~~~~~~~~~~
w.c: In function 'showinfo':
w.c:78:22: error: '__UT_NAMESIZE' undeclared (first use in this function); did you mean 'UT_NAMESIZE'?
78 | # define UT_NAMESIZE __UT_NAMESIZE
| ^~~~~~~~~~~~~
w.c:402:13: note: in expansion of macro 'UT_NAMESIZE'
402 | char uname[UT_NAMESIZE + 1] = "", tty[5 + UT_LINESIZE + 1] = "/dev/";
| ^~~~~~~~~~~
w.c:77:22: error: '__UT_LINESIZE' undeclared (first use in this function); did you mean 'UT_LINESIZE'?
77 | # define UT_LINESIZE __UT_LINESIZE
| ^~~~~~~~~~~~~
w.c:402:44: note: in expansion of macro 'UT_LINESIZE'
402 | char uname[UT_NAMESIZE + 1] = "", tty[5 + UT_LINESIZE + 1] = "/dev/";
| ^~~~~~~~~~~
w.c: In function 'main':
w.c:78:22: error: '__UT_NAMESIZE' undeclared (first use in this function); did you mean 'UT_NAMESIZE'?
78 | # define UT_NAMESIZE __UT_NAMESIZE
| ^~~~~~~~~~~~~
w.c:576:21: note: in expansion of macro 'UT_NAMESIZE'
576 | int ut_namesize = UT_NAMESIZE;
| ^~~~~~~~~~~
w.c:76:22: error: '__UT_HOSTSIZE' undeclared (first use in this function); did you mean 'UT_HOSTSIZE'?
76 | # define UT_HOSTSIZE __UT_HOSTSIZE
| ^~~~~~~~~~~~~
w.c:588:22: note: in expansion of macro 'UT_HOSTSIZE'
588 | if (fromlen < 8 || UT_HOSTSIZE < fromlen) {
| ^~~~~~~~~~~
make[2]: *** [Makefile:1556: w.o] Error 1
Looks like it's caused by commit 3c1fed7d
UT_HOSTSIZE
and friends are only provided by utmp.h
:
$ grep -Ri UT_HOSTSIZE /usr/include/
/usr/include/utmp.h:#define UT_HOSTSIZE 256
/usr/include/utmp.h: char ll_host[UT_HOSTSIZE];