troglobit/inadyn

Compilation will fail with GCC-14 due -Wimplicit-function-declaration as error

ConiKost opened this issue · 2 comments

When you try to compile latest stable release, it will fail with GCC-14, as -Wimplicit-function-declaration warnings are now treated as errors.

make -j16 
Making all in src
make[1]: Entering directory '/var/tmp/portage/net-dns/inadyn-2.12.0-r1/work/inadyn-2.12.0/src'
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-main.o `test -f 'main.c' || echo './'`main.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-ddns.o `test -f 'ddns.c' || echo './'`ddns.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-cache.o `test -f 'cache.c' || echo './'`cache.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-error.o `test -f 'error.c' || echo './'`error.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-conf.o `test -f 'conf.c' || echo './'`conf.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-os.o `test -f 'os.c' || echo './'`os.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-http.o `test -f 'http.c' || echo './'`http.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-plugin.o `test -f 'plugin.c' || echo './'`plugin.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-tcp.o `test -f 'tcp.c' || echo './'`tcp.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-json.o `test -f 'json.c' || echo './'`json.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-jsmn.o `test -f 'jsmn.c' || echo './'`jsmn.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-log.o `test -f 'log.c' || echo './'`log.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-makepath.o `test -f 'makepath.c' || echo './'`makepath.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-base64.o `test -f 'base64.c' || echo './'`base64.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-md5.o `test -f 'md5.c' || echo './'`md5.c
x86_64-pc-linux-musl-gcc -DHAVE_CONFIG_H -I. -I../include  -I../include -DSYSCONFDIR=\"/etc\" -DLOCALSTATEDIR=\"/var/lib\" -DRUNSTATEDIR=\"/var/lib/run\" -D_GNU_SOURCE -D_BSD_SOURCE -D_DEFAULT_SOURCE      -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -c -o inadyn-sha1.o `test -f 'sha1.c' || echo './'`sha1.c
In file included from ../include/compat.h:27,
                 from makepath.c:22:
makepath.c: In function 'mkpath':
makepath.c:44:24: error: implicit declaration of function 'alloca' [-Wimplicit-function-declaration[https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Warning-Options.html#index-Wimplicit-function-declaration]]
   44 |         mkpath(dirname(strdupa(dir)), mode);
      |                        ^~~~~~~
make[1]: *** [Makefile:931: inadyn-makepath.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/var/tmp/portage/net-dns/inadyn-2.12.0-r1/work/inadyn-2.12.0/src'
make: *** [Makefile:479: all-recursive] Error 1

Hmm, I cannot reproduce this. I've tested with GCC 13.2, with -Wimplicit-function-declaration, GCC 14.0.1 (Ubuntu 24.04), and GCC 14.1 on Slackware current. All on GLIBC.

So, to clarify for other readers. This is actually an incompatibility with musl libc, in combination with GCC 14. In fact, the definition of strdupa() on musl in string.h looks like this:

#define	strdupa(x)	strcpy(alloca(strlen(x)+1),x)

But string.h in musl libc does not include the definition of alloca(). On GLIBC systems this is handled by the libc, but on musl it seems it is required to include alloca.h before string.h, which is not how the man page for strdupa() is written. Granted, strdupa() is not POSIX, so the best way forward here is probably a refactor of our makepath.c.

With the refactor in b9edfbf your build should now pass.