From: "christo (Chris Alberti) via ruby-core" Date: 2025-05-15T13:45:54+00:00 Subject: [ruby-core:122119] [Ruby Bug#21340] Bump autoconf version to properly handle C23 bool/stdbool defines Issue #21340 has been updated by christo (Chris Alberti). File config.h_GCC14 added File config.h_GCC15 added nobu (Nobuyoshi Nakada) wrote in #note-1: > Isn't `HAVE_STDBOOL_H` defined? > `HAVE_STD_BOOL_H` should be for `std_bool.h`. Not if you build on GCC 15 (or C23) using the ./configure script packaged with the official ruby release tar.gz. GCC 15 bumps the default C standard to gnu23 which is where the issue is introduced. The problem is that the test in Ruby's _old_ ./configure is broken on C23 because of the new native definitions of bool/true/false. [Read the autoconf commit I linked]((https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=6dcecb780a69bd208088d666b299e92aa7ae7e80;hp=f6657256a37da44c987c04bf9cd75575dfca3b60)) for context. They fixed this in 2022. If you run the included ./configure with GCC 14 or lower, or with GCC 15 with -std=gnu17 or lower, you get a config.h which _does_ define `HAVE_STDBOOL_H`. If you run the included ./configure with GCC 15 or a lower version with -std=gnu23, you get a config.h which _does not_ define `HAVE_STDBOOL_H`. If you use the latest autoconf (2.72 on my system) to recreate the ./configure script, then run that new `./configure` on GCC15 (or -std=gnu23), you get a config.h which _does_ correctly define `HAVE_STDBOOL_H`. Please reopen this... Should be a pretty easy win. ---------------------------------------- Bug #21340: Bump autoconf version to properly handle C23 bool/stdbool defines https://bugs.ruby-lang.org/issues/21340#change-113273 * Author: christo (Chris Alberti) * Status: Feedback * ruby -v: 3.4.3, 3.5.0, any built with GCC 15 (so C23) * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- Right now if I install a recent release using rbenv or asdf, or manually download the latest release 3.4.3 or the preview 3.5.0, the included `./configure` seems to have been generated by an old version of autoconf. After running `./configure`, I end up with a `config.h` containing `HAVE__BOOL = 1`, but _not_ containing `HAVE_STD_BOOL_H = 1`. If I grab the source from github (latest, or 3.4.3 tag) and run autoconf myself (I'm currently on 2.72), I get a config.h with both `HAVE__BOOL = 1` and `HAVE_STD_BOOL_H = 1` defined. This ends up meaning that in the official releases, Ruby's internal/stdbool.h skips using and moves on to defining bool/true/false itself. This is not valid as of C23 (which is now default in GCC 15). On my end I found this because I was seeing build failures in the geoip2_compat gem related to issues with the bool type definition on GCC 15. I submitted a patch to the gem's repo for a workaround (include before ruby.h), but this might come back to bite other native extension gem compiles as well. It looks like autoconf was patched to fix the HAVE_STD_BOOL_H define for C23 in [this commit](https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=6dcecb780a69bd208088d666b299e92aa7ae7e80;hp=f6657256a37da44c987c04bf9cd75575dfca3b60). I can tell that the ./configure included in the official ruby releases was created with an older version of autoconf because I still see the line: ``` Check for stdbool.h that conforms to C99 ``` rather than the updated version (which appears in my ./configure created with autoconf 2.72) ``` Check for stdbool.h that conforms to C99 or later ``` I'd happily submit a PR if the setup around packaging the official releases is public and someone can point me to it! I wasn't able to find it on a quick search. ---Files-------------------------------- config.h_GCC14 (14.7 KB) config.h_GCC15 (14.7 KB) -- 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/