Misc #21290
openUnable to build ruby extension on Fedora 42 due to possible GCC 15 issues
Description
At least one Ruby extension (ed25519) fails to build due to incompatibilities(?) with the core library headers on Fedora 42.
When trying to build the ed25519 extension that is required for Kamal (and I guess Rails by association) there are errors relating to bool
types. I'm assuming this is related to the inclusion of GCC 15 by default in version 42.
For example:
<mise dir>/installs/ruby/3.4.3/include/ruby-3.4.0/ruby/internal/core/rtypeddata.h:578:15: note: ‘bool’ is defined in
header ‘<stdbool.h>’; this is probably fixable by adding ‘#include <stdbool.h>’
In file included from <mise dir>/installs/ruby/3.4.3/include/ruby-3.4.0/ruby/ruby.h:42:
<mise dir>/installs/ruby/3.4.3/include/ruby-3.4.0/ruby/internal/memory.h:420:5: error: unknown type name ‘bool’
420 | bool left; /**< Whether overflow happened or not. */
| ^~~~
<mise dir>/installs/ruby/3.4.3/include/ruby-3.4.0/ruby/internal/memory.h:65:1: note: ‘bool’ is defined in header
‘<stdbool.h>’; this is probably fixable by adding ‘#include <stdbool.h>’
64 | #include "ruby/internal/stdckdint.h"
+++ |+#include <stdbool.h>
65 | #include "ruby/internal/xmalloc.h"
<mise dir>/installs/ruby/3.4.3/include/ruby-3.4.0/ruby/internal/memory.h: In function ‘rbimpl_size_mul_overflow’:
<mise dir>/installs/ruby/3.4.3/include/ruby-3.4.0/ruby/internal/memory.h:574:49: error: ‘false’ undeclared (first use in
this function)
574 | struct rbimpl_size_mul_overflow_tag ret = { false, 0, };
| ^~~~~
I logged the relevant issue with Kamal and the ed25519 projects but figured the issue should be tracked here as anyone upgrading to Fedora 42 won't probably be able to use Rails if starting from scratch.
Those issues are:
It's possible it is related to this issue also: https://bugs.ruby-lang.org/issues/21024. I have tried downgrading to Ruby 3.4.1 and even older, non-3.4 versions and the issue seems to be the same.
I'm running:
- Fedora 42
- Ruby 3.4+
Please let me know if you need additional information.
Updated by dennmart (Dennis Martinez) 7 days ago
For some additional context just in case it's helpful here, I've been running into this same issue on my Fedora 42 system and I noticed that the ed25519 gem is building its extensions using the -std=c99
flag. When I remove that flag, the gem extensions compile correctly without any issues.
I'm not a C programmer so I'm not sure if this flag is necessary for the gem, or if it's a potential Ruby/GCC 15 issue. I've included this in the reported issue on the gem repo.
Updated by nobu (Nobuyoshi Nakada) 7 days ago
I can't reproduce the failure on Fedora 42 aarch64.
gem install --user ed25519
succeeded with ruby installed by dnf
.
Anyway, -std=c99
flag is nonsense for other than gcc family.
Use append_cflags
instead of adding them blindly.
Updated by dennmart (Dennis Martinez) 1 day ago
Thanks for the heads-up about using append_flags
. I used it to fix the issue for the ed25519 gem and a new version was released resolving the problem. I think this issue can be closed.
Updated by anykeyh (Yacine PETITPREZ) 1 day ago
I confirm I have the same problem on arch. With multiple ruby version (3.2, 3.3, 3.4). Example of gems failing are jaro_winkler
or ruby-prof
.
Is there any way to fix without touching gem code? Some kind of system flag to set?