Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1284684 - ruby-libs should not hard-code Fedora build flags
Summary: ruby-libs should not hard-code Fedora build flags
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: ruby
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jeroen van Meeuwen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1401266 1551081 (view as bug list)
Depends On: 1218294 1543394
Blocks: 1432191 Fedora28BuildFlags 1905222
TreeView+ depends on / blocked
 
Reported: 2015-11-23 22:01 UTC by François Kooman
Modified: 2020-12-14 18:11 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1432191 0 unspecified NEW rubygems: gcc fails to compile software when redhat-rpm-config isn't installed 2022-05-16 11:32:56 UTC
Ruby 14422 0 None None None 2018-01-30 07:18:08 UTC

Internal Links: 1432191

Description François Kooman 2015-11-23 22:01:07 UTC
Description of problem:

RROR: Failed to build gem native extension.

gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory

Version-Release number of selected component (if applicable):

ruby-devel-2.2.3-44.fc23.x86_64

How reproducible:

always

Steps to Reproduce:
1. forget to install redhat-rpm-config
2. try to build gem native extension
3. fail with gcc error above

Actual results:

error...

Expected results:

no error.

Additional info:

dnf -y install redhat-rpm-config fixes it, it should be a dependency of something I guess...

Comment 1 Josef Stribny 2015-11-24 09:41:59 UTC
I already documented this here:
https://developer.fedoraproject.org/tech/languages/ruby/gems-installation.html

Anyway, I agree that this dependency is necessary and should be stated.

Comment 2 Vít Ondruch 2015-11-24 11:45:19 UTC
This seems to be similar to Python bug 1217376 and there is also some subsequent bug 1218294

Comment 3 Fedora End Of Life 2016-11-24 13:40:23 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Vít Ondruch 2016-11-25 15:34:20 UTC
This was not resolved yet if I am not mistaken.

Comment 5 Vít Ondruch 2016-12-05 09:55:11 UTC
*** Bug 1401266 has been marked as a duplicate of this bug. ***

Comment 6 Mamoru TASAKA 2016-12-07 23:39:27 UTC
Well, if I am not mistaken, the real problem here is that rpm's %optflags is always embedded into Fedora's ruby config file, that is 

/usr/lib64/ruby/rbconfig.rb:167:  CONFIG["CXXFLAGS"] = "-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic"
/usr/lib64/ruby/rbconfig.rb:171:  CONFIG["CFLAGS"] = "-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC"

on x86_64, for example.

Although I am not sure this is already discussed somewhere or not, basically I think changing the default CFLAGS of "system" ruby like this way is undesirable and installed "rbconfig.rb" should have some "minimal" CFLAGS / CXXFLAGS.
( for example, just like CONFIG["CFLAGS"] = "-fPIC" )

Only when we build Fedora gems or so (on koji), we should change CFLAGS / CXXFLAGS explicitly afterwards using %optflags.

Note that Qt people now actually do this way, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1279265
and
https://lists.fedoraproject.org/archives/list/devel%40lists.fedoraproject.org/message/6TLCJFMMVPYHJKDL4XZYUEO66GYM64I7/
i.e. they explicitly remove Fedora %optflags from installed qmake related files.

Comment 7 Mamoru TASAKA 2016-12-07 23:45:08 UTC
Note that doing the way in my comment 6 may have to change %gem_install in some way, however I think changing CFLAGS only when we use %gem_install is desirable.

Comment 8 Vít Ondruch 2016-12-08 11:15:09 UTC
(In reply to Mamoru TASAKA from comment #6)
> Well, if I am not mistaken, the real problem here is that rpm's %optflags is
> always embedded into Fedora's ruby config file, that is 
> 
> /usr/lib64/ruby/rbconfig.rb:167:  CONFIG["CXXFLAGS"] = "-O2 -g -pipe -Wall
> -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic"
> /usr/lib64/ruby/rbconfig.rb:171:  CONFIG["CFLAGS"] = "-O2 -g -pipe -Wall
> -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC"
> 
> on x86_64, for example.

The question is what is the role of these values in rbconfig.rb. Is it just recorded configuration of Ruby itself? Is it to use the same configuration for the Ruby dependencies? I'd say both is true and I don't see any reason, why the gem should use different configuration options then Ruby itself. But if different configuration for Ruby and gems is desirable, I'd like to see this modified upstream.

> Although I am not sure this is already discussed somewhere or not

I am not aware of any broader discussion...

> I think changing the default CFLAGS of "system" ruby like this way is
> undesirable and installed "rbconfig.rb" should have some "minimal" CFLAGS /
> CXXFLAGS.
> ( for example, just like CONFIG["CFLAGS"] = "-fPIC" )
> 
> Only when we build Fedora gems or so (on koji), we should change CFLAGS /
> CXXFLAGS explicitly afterwards using %optflags.
> 
> Note that Qt people now actually do this way, see:

QT guys decided one way, Python guys (bug 1218294) seems to be in favor of other way. Personally, I side with Python guys.

Comment 9 Fedora End Of Life 2017-02-28 09:50:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 10 Ryan 2017-07-13 05:03:13 UTC
This is currently affecting clean installs of Fedora 26 Workstation. I just installed a test vm using the default live DVD and performed 'dnf install ruby'. After doing this, I performed a 'gem update' and immediately received a build error stating that firstly it was missing JSON support, and (after installing this) also that it required 'development tools to be installed' which turned out to be 'redhat-rpm-config'.

Comment 11 Florian Weimer 2018-01-26 16:15:36 UTC
(In reply to Vít Ondruch from comment #8)
> (In reply to Mamoru TASAKA from comment #6)
> > Well, if I am not mistaken, the real problem here is that rpm's %optflags is
> > always embedded into Fedora's ruby config file, that is 
> > 
> > /usr/lib64/ruby/rbconfig.rb:167:  CONFIG["CXXFLAGS"] = "-O2 -g -pipe -Wall
> > -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> > -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> > -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic"
> > /usr/lib64/ruby/rbconfig.rb:171:  CONFIG["CFLAGS"] = "-O2 -g -pipe -Wall
> > -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> > -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> > -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -mtune=generic -fPIC"
> > 
> > on x86_64, for example.
> 
> The question is what is the role of these values in rbconfig.rb. Is it just
> recorded configuration of Ruby itself? Is it to use the same configuration
> for the Ruby dependencies? I'd say both is true and I don't see any reason,
> why the gem should use different configuration options then Ruby itself. But
> if different configuration for Ruby and gems is desirable, I'd like to see
> this modified upstream.

The current advice of the Red Hat toolchain team is to keep distribution build flags and toolchain default flags separate.  This is why running “gcc” gives you the upstream defaults, and not the flags we use to compile Fedora packages.  For consistency, Ruby (and other compilation support tools) follow this pattern: Use distribution flags when building for Fedora, but use upstream flags when the user compiles packages (i.e., what Ruby uses, probably something involving -O2).

Our build flags are fully ABI-compatible with each other, so mismatches will not cause any problems at the C/C++/ABI level.

Comment 12 Vít Ondruch 2018-01-30 07:18:09 UTC
Time to discuss this upstream.

Comment 13 Vít Ondruch 2018-03-02 18:46:07 UTC
*** Bug 1551081 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.