Issue: gnome-base/libgtop-2.40.0-r2 has implicit function declarations in configure logs (MUSL-CLANG-SYSTEM).
Discovered on: amd64 (internal ref: tinderbox_musl)
(MUSL-CLANG-SYSTEM) in the summary means that bug was found on a machine that runs MUSL libc + clang16 but this bug MAY or MAY NOT BE related to musl/clang16.
See also: https://bugs.gentoo.org/898488#c4.
Created attachment 855690 [details]
build log and emerge --info
The error is
> configure:16692: checking for working mmap
> configure:16844: x86_64-pc-linux-gnu-clang -o conftest -O2 -march=native -pipe -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-function-pointer-types -std=c99 -Wl,-O1 -Wl,--as-needed conftest.c >&5
> conftest.c:138:14: error: call to undeclared function 'getpagesize'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
> pagesize = getpagesize ();
> 1 error generated.
This occurs in the 'checking for working mmap' configure test, *not* in 'checking for getpagesize' which is immediately before it.
It comes from AC_FUNC_MMAP. That macro compiles code using getpagesize. getpagesize(2) says the function is provided by unistd.h, but the code only includes
> #include <fcntl.h>
> #include <sys/mman.h>
I struggled to reproduce this in a git checkout of libgtop until I realized that the reason is the ebuild does this:
> # Add explicit stdc, bug #628256
> append-cflags "-std=c99"
With CFLAGS="-std=c99 ..." I can reproduce the issue.
This seems like a bug in autoconf's AC_FUNC_MMAP. Cc'ing autoconf maintainers.
It looks broken upstream as well.
Reported at https://lists.gnu.org/archive/html/bug-autoconf/2023-05/msg00002.html, thanks
I submitted a (yet untested) patch.
Two patches landed upstream that resolve the issue: