From: "stanhu (Stan Hu) via ruby-core" Date: 2025-07-23T20:22:08+00:00 Subject: [ruby-core:122845] [Ruby Bug#21519] `configure` script in Ruby tarballs should be generated with autoconf 2.72+ for C23 compilers Issue #21519 has been updated by stanhu (Stan Hu). Oh, this is a duplicate of https://bugs.ruby-lang.org/issues/21340. ---------------------------------------- Bug #21519: `configure` script in Ruby tarballs should be generated with autoconf 2.72+ for C23 compilers https://bugs.ruby-lang.org/issues/21519#change-114133 * Author: stanhu (Stan Hu) * Status: Open * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- The `autoconf` used to generate `configure` in the Ruby source downloads needs to be updated from 2.71 to 2.72 to fix compatibility with C23 compilers, such as GCC 15. This is related to https://bugs.ruby-lang.org/issues/21024, but this is focused on C, not C++, compilation. This is also related to gem compilation issues, such as: * https://github.com/socketry/io-event/issues/136 * https://jira.mongodb.org/browse/RUBY-3675 * https://github.com/cabo/cbor-ruby/issues/27 These gems worked around the problem by using `append_cflags` instead of `CFLAGS`. That fixes the problem because `-std=c99` is omitted entirely, even for `gcc`. However, this masks the problem that for GCC 15, the Ruby headers should include ``. If a gem really needed to use an older C version, `append_cflags` would always throw it out in GCC 15 because `bool` is not defined without including that header. As mentioned in https://gcc.gnu.org/gcc-15/porting_to.html#c23, GCC 15 defaults to C23 now: > In C99 and later you can use #include which provides definitions of bool, true, and false compatible with C23. The `configure` script checks whether `stdbool.h` is available and defines `HAVE_STDBOOL_H` if it is. However, if I install `ruby 3.4.4` via `mise` with the Docker image `fedora:42`, I see this in the build logs: ``` configure:13530: checking for stdbool.h that conforms to C99 configure:13646: gcc -c -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -O3 -fno-fast-math -ggdb3 conftest.c >&5 conftest.c:103:17: error: #error "bool is not defined" 103 | #error "bool is not defined" | ^~~~~ conftest.c:106:17: error: #error "false is not defined" 106 | #error "false is not defined" | ^~~~~ conftest.c:109:17: error: #error "true is not defined" 109 | #error "true is not defined" | ^~~~~ configure:13646: $? = 1 ``` Attached is the test program used by `configure`: [test-bool.txt](https://github.com/user-attachments/files/21394404/test-bool.txt) It seems that this test is outdated. It needs this `autoconf` fix for C23: https://cgit.git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6dcecb780a69bd208088d666b299e92aa7ae7e80. If I install `autoconf` and run this: ``` autoreconf -fiv ./configure ``` Then it works: ``` checking for stdbool.h that conforms to C99 or later... yes ``` If we peek at `https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.4.tar.gz`: ``` # curl -O https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.4.tar.gz # tar xzf ruby-3.4.4.tar.gz # head -3 ruby-3.4.4/configure #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.71. ``` I believe `autoconf` needs to be updated to 2.72. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/