RbConfig::CONFIG["ruby_version"]

Mamoru TASAKA mtasaka at fedoraproject.org
Thu Dec 4 01:12:07 UTC 2014


Darryl L. Pierce wrote on 12/04/2014 06:56 AM:
> I have a gem I package for Fedora [1] that has a new feature coming with
> our next release. That feature depends on being able to release the GIL
> for blocking operations so that other threads in the app can get
> interpreter time.
>
> The determination as to which GIL-releasing API to call is determined at
> install time via extconf.rb:
>
> ---8<[snip]---
>
> # set the ruby version compiler flag
> runtime_version = RbConfig::CONFIG["ruby_version"].gsub(/\./,"")[0,2]
> $CFLAGS << " -DRUBY#{runtime_version}"
>
> ---8<[snip]---
>
> And in the native code is decides based on whether RUBY19, RUBY20 or
> RUBY21 is defined (RUBY18 is a noop in this case).
>
> However, on Fedora 19+ and RHEL7 this fails. The reason is because the
> Ruby package for F19-F22/EL7 returns an empty string for the above value
> in RbConfig::CONFIG. On Windows, Ubuntu, Debian and the Mac it outputs
> the version info for the VM.
>
> I filed a BZ for this (BZ#1170282) and would consider this a blocker
> since I won't be able to release an updated RPM for my gem when we have
> our next release due to this bug.
>
> Any proven packager here who could give this BZ some lovin' and get a
> fix pushed?
>

While here I won't say my opinition for whether ruby_version
should be set or not, I closed your report as a duplicate of BZ923703.

BTW skf (I maintain) do the following:

$  ruby -rrbconfig -e'printf "%.1s%.1s\n",RbConfig::CONFIG.fetch("MAJOR"),RbConfig::CONFIG.fetch("MINOR")'
21

Regards,
Mamoru



More information about the ruby-sig mailing list