glib 2.74.4 fails to compile for some configurations due to missing errno.h header
Greetings,
Updating from glib 2.74.3 to glib 2.74.4, glib 2.74.4 failed to build. The system runs gnu/linux, similar to LFS, with glibc 2.27 as the C library.
glib 2.74.3 built successfully with the same system configuration.
Here is a trace of the errors produced by the failed build.
[11/1288] Compiling C object glib/libglib-2.0.so.0.7400.4.p/gbacktrace.c.o
[12/1288] Compiling C object glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o
FAILED: glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o
cc -Iglib/libglib-2.0.so.0.7400.4.p -Iglib -I../glib -I. -I.. -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -std=gnu99 -O3 -D_GNU_SOURCE -fno-strict-aliasing -DG_DISABLE_CAST_CHECKS -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wunused -Wno-unused-parameter -Wno-cast-function-type -Wno-pedantic -Wno-format-zero-length -Wno-variadic-macros -Werror=format=2 -Werror=init-self -Werror=missing-include-dirs -Werror=pointer-arith -Werror=unused-result -Wstrict-prototypes -Wno-bad-function-cast -Werror=declaration-after-statement -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=pointer-sign -march=native -O2 -pipe -fPIC -pthread '-DG_LOG_DOMAIN="GLib"' -DGLIB_COMPILATION -fvisibility=hidden -MD -MQ glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o -MF glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o.d -o glib/libglib-2.0.so.0.7400.4.p/gbitlock.c.o -c ../glib/gbitlock.c
In file included from ../glib/gbitlock.c:34:
../glib/gbitlock.c: In function 'g_futex_wait':
../glib/gthreadprivate.h:68:20: error: 'errno' undeclared (first use in this function)
68 | if (res < 0 && errno == ENOSYS) \
| ^~~~~
../glib/gbitlock.c:77:3: note: in expansion of macro 'g_futex_simple'
77 | g_futex_simple (address, (gsize) FUTEX_WAIT_PRIVATE, (gsize) value, NULL);
| ^~~~~~~~~~~~~~
../glib/gbitlock.c:35:1: note: 'errno' is defined in header '<errno.h>'; did you forget to '#include <errno.h>'?
34 | #include "gthreadprivate.h"
+++ |+#include <errno.h>
35 |
../glib/gthreadprivate.h:68:20: note: each undeclared identifier is reported only once for each function it appears in
68 | if (res < 0 && errno == ENOSYS) \
| ^~~~~
../glib/gbitlock.c:77:3: note: in expansion of macro 'g_futex_simple'
77 | g_futex_simple (address, (gsize) FUTEX_WAIT_PRIVATE, (gsize) value, NULL);
| ^~~~~~~~~~~~~~
../glib/gthreadprivate.h:68:29: error: 'ENOSYS' undeclared (first use in this function)
68 | if (res < 0 && errno == ENOSYS) \
| ^~~~~~
../glib/gbitlock.c:77:3: note: in expansion of macro 'g_futex_simple'
77 | g_futex_simple (address, (gsize) FUTEX_WAIT_PRIVATE, (gsize) value, NULL);
| ^~~~~~~~~~~~~~
../glib/gbitlock.c: In function 'g_futex_wake':
../glib/gthreadprivate.h:68:20: error: 'errno' undeclared (first use in this function)
68 | if (res < 0 && errno == ENOSYS) \
| ^~~~~
../glib/gbitlock.c:94:3: note: in expansion of macro 'g_futex_simple'
94 | g_futex_simple (address, (gsize) FUTEX_WAKE_PRIVATE, (gsize) 1, NULL);
| ^~~~~~~~~~~~~~
../glib/gthreadprivate.h:68:20: note: 'errno' is defined in header '<errno.h>'; did you forget to '#include <errno.h>'?
68 | if (res < 0 && errno == ENOSYS) \
| ^~~~~
../glib/gbitlock.c:94:3: note: in expansion of macro 'g_futex_simple'
94 | g_futex_simple (address, (gsize) FUTEX_WAKE_PRIVATE, (gsize) 1, NULL);
| ^~~~~~~~~~~~~~
../glib/gthreadprivate.h:68:29: error: 'ENOSYS' undeclared (first use in this function)
68 | if (res < 0 && errno == ENOSYS) \
| ^~~~~~
../glib/gbitlock.c:94:3: note: in expansion of macro 'g_futex_simple'
94 | g_futex_simple (address, (gsize) FUTEX_WAKE_PRIVATE, (gsize) 1, NULL);
| ^~~~~~~~~~~~~~
[13/1288] Compiling C object glib/libglib-2.0.so.0.7400.4.p/gbase64.c.o
[14/1288] Compiling C object glib/libglib-2.0.so.0.7400.4.p/garray.c.o
ninja: build stopped: subcommand failed.
Dominic Jones jonesd@xmission.com
Edited by Andre Klapper