From: Quan Sun <[email protected]> The has_function('close_range') check succeeds at link time on hosts with kernel >= 5.9 even when glibc does not declare the function (glibc < 2.34, e.g. AlmaLinux 8 / CentOS 8 with glibc 2.28). This causes CONFIG_CLOSE_RANGE to be set, but compilation then fails with:
error: implicit declaration of function 'close_range' Fix by adding a prefix that includes <unistd.h>, so the meson check only succeeds when the C library actually declares close_range() in its headers. Signed-off-by: Quan Sun <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index eb074918193..e396394f4c1 100644 --- a/meson.build +++ b/meson.build @@ -2596,7 +2596,7 @@ if host_os == 'windows' endif # has_function -config_host_data.set('CONFIG_CLOSE_RANGE', cc.has_function('close_range')) +config_host_data.set('CONFIG_CLOSE_RANGE', cc.has_function('close_range', prefix: '#include <unistd.h>')) config_host_data.set('CONFIG_ACCEPT4', cc.has_function('accept4')) config_host_data.set('CONFIG_CLOCK_ADJTIME', cc.has_function('clock_adjtime')) config_host_data.set('CONFIG_DUP3', cc.has_function('dup3')) -- 2.53.0
