Bug #21372
closedRuby is passing clang specific flags to GCC 15 and native gem doesn't build.
Description
Fedora 42 has ompilation errors while running gem install extlz4
.
At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
make: *** [Makefile:251: blockapi.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/sk/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/gems/extlz4-0.3.4 for inspection.
Results logged to /home/sk/.local/share/mise/installs/ruby/3.4.1/lib/ruby/gems/3.4.0/extensions/x86_64-linux/3.4.0/extlz4-0.3.4/gem_make.out
I have submitted a ticket with a gem, but I have hunch that this might not be an issue with a gem, but rather a ruby compatibility issue with the new GCC (15).
@see https://github.com/dearblue/ruby-extlz4/issues/6
I have very little experience with C and how compilation works. But as far as I can understand, ruby was compiled with clang and is now passing some CLANG specifics flags to GCC 15 during native gem compilation - this causes a compilation error.
ruby -rrbconfig -e 'puts RbConfig::CONFIG["warnflags"].split(/\s+/).grep(/-Wno-/).sort'
-Wno-cast-function-type
-Wno-constant-logical-operand
-Wno-long-long
-Wno-missing-field-initializers
-Wno-overlength-strings
-Wno-packed-bitfield-compat
-Wno-parentheses-equality
-Wno-self-assign
-Wno-tautological-compare
-Wno-unused-parameter
-Wno-unused-value
ruby -rrbconfig -e 'system RbConfig::CONFIG["CC"], "--version"'
gcc (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2)
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
All my attept to overwrite compiler to use clang don't work either. I tried the following:
gem install extlz4 -- --with-cc=clang
CC=clang gem install extlz4
CC=/usr/bin/clang gem install extlz4
System¶
os: fedora 42
ruby: ruby 3.4.4 (2025-05-14 revision a38531fd3f) +PRISM [x86_64-linux] (but also tried it with 3.3.8, with no success)
gcc: gcc (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2)
Workaround¶
I run the following script and then it's possible to complete "bundle install" process.
https://gist.github.com/skatkov/df4db6f8b76e58fc8eefaa92592f2c1a
Updated by alanwu (Alan Wu) about 8 hours ago
- Status changed from Open to Third Party's Issue
Resolved downstream; wasn't about the options passed.