Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 898816 - sys-devel/autoconf: AC_FUNC_MMAP check is broken (was: gnome-base/libgtop-2.40.0-r2 has implicit function declarations in configure logs (MUSL-CLANG-SYSTEM))
Summary: sys-devel/autoconf: AC_FUNC_MMAP check is broken (was: gnome-base/libgtop-2.4...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Blocks: 906027
  Show dependency tree
Reported: 2023-03-02 09:36 UTC by Agostino Sarubbo
Modified: 2023-05-11 14:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

build.log (build.log,184.07 KB, text/plain)
2023-03-02 09:36 UTC, Agostino Sarubbo

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2023-03-02 09:36:25 UTC

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:
Comment 1 Agostino Sarubbo gentoo-dev 2023-03-02 09:36:28 UTC
Created attachment 855690 [details]

build log and emerge --info
Comment 2 Matt Turner gentoo-dev 2023-05-09 20:28:33 UTC
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.
Comment 3 Matt Turner gentoo-dev 2023-05-09 20:35:48 UTC
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.
Comment 4 Matt Turner gentoo-dev 2023-05-09 20:36:50 UTC
This seems like a bug in autoconf's AC_FUNC_MMAP. Cc'ing autoconf maintainers.

It looks broken upstream as well.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-10 01:45:37 UTC
Reported at, thanks
Comment 6 Matt Turner gentoo-dev 2023-05-10 15:16:01 UTC
I submitted a (yet untested) patch.