I saw following error when I tried to build Linux x86_64 devkit on glibc 2.43
system (Fedora 44):
/usr/src/jdk/build/devkit/src/binutils-2.43/gprofng/libcollector/iolib.c: In
function 'is_not_the_log_
file':
/usr/src/jdk/build/devkit/src/binutils-2.43/gprofng/libcollector/iolib.c:898:18:
error: expected ident
ifier before '_Generic'
898 | if (CALL_UTIL (strstr)(fname, SP_LOG_FILE) == NULL)
| ^~~~~~
/usr/src/jdk/build/devkit/src/binutils-2.43/gprofng/libcollector/iolib.c:898:7:
note: in expansion of
macro 'CALL_UTIL'
898 | if (CALL_UTIL (strstr)(fname, SP_LOG_FILE) == NULL)
| ^~~~~~~~~
GEN doc/strings.1
mv -f .deps/libgp_collector_la-gethrtime.Tpo
.deps/libgp_collector_la-gethrtime.Plo
make[7]: *** [Makefile:645: libgp_collector_la-iolib.lo] Error 1
According to release notes of glibc 2.43, `_Generic` macro has been introduced
as a part of C23, and it might break some packages [1]. It is binutils in
devkit.
It is not a bug in OpenJDK and devkit, but it is better if we can avoid the
problem with some options. The problem is in gprofng, so we can avoid the
problem if we can add `--disable-gprofng` in configure options of binutils.
gprofng is a profiler, so it is not required for devkit.
Note that we cannot build Linux x86_64 devkit on Fedora 44 (glibc 2.43 + gcc
16.1) with this change only. We also need to add `-std=gnu17`. I exclude it
from this change (so far) because we can add it via `CFLAGS` environment
variable and I'm not sure how it affects in older C compilers.
[1]
https://sourceware.org/glibc/wiki/Release/2.43#C23_Const-Preserving_Standard_Library_Macros_May_Break_Some_Packages
---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK
Interim AI Policy](https://openjdk.org/legal/ai).
-------------
Commit messages:
- 8386625: Devkit could not be built on glibc 2.43+
Changes: https://git.openjdk.org/jdk/pull/31511/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31511&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8386625
Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/31511.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/31511/head:pull/31511
PR: https://git.openjdk.org/jdk/pull/31511