Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 588334 - dev-lang/ruby: uses hardcoded CC from earlier dev-lang/ruby build when building extensions
Summary: dev-lang/ruby: uses hardcoded CC from earlier dev-lang/ruby build when buildi...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: tc-directly
  Show dependency tree
 
Reported: 2016-07-08 13:24 UTC by Michał Górny
Modified: 2023-04-10 04:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log (dev-ruby:json-2.0.1:20160708-131530.log,3.55 KB, text/x-log)
2016-07-08 13:24 UTC, Michał Górny
Details
mkmf.log (mkmf.log,651 bytes, text/x-log)
2016-07-08 13:24 UTC, Michał Górny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-08 13:24:20 UTC
Created attachment 440068 [details]
build log

As can be deduced from the almost-completely-useless logs, build of dev-ruby/json failed for me trying to use no-longer-installed gcc version that I happened to have in CC when I rebuilt dev-lang/ruby last time. Which means it doesn't respect the current value of CC/CXX after all.

If this is a generic issue with Ruby packages, feel free to transform this bug into a generic one.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-08 13:24:38 UTC
Created attachment 440070 [details]
mkmf.log
Comment 2 Hans de Graaff gentoo-dev Security 2016-07-09 05:34:49 UTC
Yes, this is a generic ruby extension built system issue. I think bug 476668 is related.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-18 01:07:25 UTC
I suspect the modern-day version of this was fixed by:

commit 2a348f36672c06a1075dc02a0ca852f7934fbdbf
Author: Hans de Graaff <graaff@gentoo.org>
Date:   Mon Aug 23 19:33:18 2021 +0200

    eclass/ruby-fakegem.eclass: set flags for compilation

    Explicitly pass CC, CFLAGS and LDFLAGS when compiling ruby
    extensions. By default ruby re-uses the stored flags used when
    compiling ruby itself. This is intended to create a better chance of
    compatibility between extensions and ruby itself, and extensions do
    not need to bother with this themselves, but it does not match the
    expectations of a Gentoo system where each compile action should use
    the currently defined flags.

    We also cannot guarantee this compatibility in any case since
    toolchain packages may have been updated in the meantime.

    This change uses the current CC, CFLAGS and LDFLAGS, and adds -fPIC
    which ruby extensions need and which would otherwise be added by
    ruby. This combination is already used in some ebuilds without any
    reported issues.

    Signed-off-by: Hans de Graaff <graaff@gentoo.org>

commit f02edc97cad6e965ddf85db2af4b978c732f13ab
Author: Hans de Graaff <graaff@gentoo.org>
Date:   Fri Nov 19 11:01:15 2021 +0100

    eclass/ruby-fakegem.eclass: fix CFLAGS and LDFLAGS for extensions

    Set the CFLAGS and LDFLAGS for extensions using the mkmf options
    during configuration. This ensures that the flags are correctly set in
    the Makefile and we don't need to second-guess any further actions of
    extensions themselves, leading to breakage that is hard to work
    around.

    Closes: https://bugs.gentoo.org/823730

    Signed-off-by: Hans de Graaff <graaff@gentoo.org>

fwiw I haven't seen this kind of problem in a long time