Bug #19271
closedirb ignores rbs and debug
Description
Not sure this is a serious issue but when starting IRB this (potentially confusing) message is immediately printed:
$ irb
Ignoring debug-1.7.1 because its extensions are not built. Try: gem pristine debug --version 1.7.1
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
irb(main):001:0>
This is on a fresh installation of Ruby 3.2.0 with an empty Gemfile in the directory.
I haven't run gem pristine on any gem since I hadn't installed any gems after installing Ruby 3.2.0 here but FYI:
$ gem list | grep "rbs\|debug"
debug (1.7.1)
rbs (2.8.2)
This seems to suggest that C extensions weren't built for those gems when they were installed during the Ruby installation process. Just to be safe I checked and while I do use rbenv and ruby-build to compile and manage Rubies, I don't have a default gem installer set up so as far as I know these gems weren't installed by my system.
Updated by olivierlacan (Olivier Lacan) almost 2 years ago
Impossible to edit the original issue (loads a blank form, looks like a Redmine bug) but ruby -v
should read:
ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]
I accidentally ran it in the wrong terminal tab when writing the above.
Updated by st0012 (Stan Lo) almost 2 years ago
I can reproduce this without IRB
:
$ RUBY_YJIT_ENABLE=1 ruby -e "require 'foo'"
Ignoring debug-1.7.1 because its extensions are not built. Try: gem pristine debug --version 1.7.1
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
<internal:/Users/st0012/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- foo (LoadError)
from <internal:/Users/st0012/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from -e:1:in `<main>'
Even without RUBY_YJIT_ENABLE=1
too:
(This one doesn't have message about debug
because I installed it during testing)
$ ruby -e "require 'foo'"
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
<internal:/Users/st0012/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- foo (LoadError)
from <internal:/Users/st0012/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from -e:1:in `<main>'
I think it's actually related to Ruby's LoadError
and it's just happen that IRB
triggers one during initialization.
It's probably because those gems' extensions failed to build. I do get an error when trying to run rbs
:
$ rbs
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
<internal:/Users/st0012/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- rbs_extension (LoadError)
from <internal:/Users/st0012/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /Users/st0012/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rbs-2.8.2/lib/rbs.rb:54:in `<top (required)>'
from <internal:/Users/st0012/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/Users/st0012/.rbenv/versions/3.2.0/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /Users/st0012/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/rbs-2.8.2/exe/rbs:4:in `<top (required)>'
from /Users/st0012/.rbenv/versions/3.2.0/bin/rbs:25:in `load'
from /Users/st0012/.rbenv/versions/3.2.0/bin/rbs:25:in `<main>'
Updated by k0kubun (Takashi Kokubun) almost 2 years ago
- Subject changed from irb ignores rbs and debug with YJIT enabled to irb ignores rbs and debug
- Description updated (diff)
- Assignee set to hsbt (Hiroshi SHIBATA)
- ruby -v changed from ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21] to ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]
YJIT or RUBY_YJIT_ENABLE=1
doesn't interfere with that process, and I confirmed that this is reproducible without YJIT as @st0012 (Stan Lo) did. So removing the reference to YJIT from the ticket description, also fixing ruby -v
as you said.
$ rm -rf /opt/rubies/3.2.0
$ rm -rf ~/.gem
$ ruby-install 3.2.0
$ /opt/rubies/3.2.0/bin/irb
Ignoring debug-1.6.3 because its extensions are not built. Try: gem pristine debug --version 1.6.3
Ignoring rbs-2.7.0 because its extensions are not built. Try: gem pristine rbs --version 2.7.0
irb(main)[01:0]>
I recall @hsbt (Hiroshi SHIBATA) said he'll investigate the issue that those warning messages are printed, so I'll send this to his way.
Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago
- Status changed from Open to Assigned
I couldn't reproduce this with fresh install of Ruby 3.2.0 from tarball.
If you use GEM_HOME
and share it with each Ruby versions or builds, you may encounter this (It's known issue). After I removed GEM_HOME
environmental variable, I confirmed to work it correctly.
Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago
Ignoring debug-1.6.3 because its extensions are not built. Try: gem pristine debug --version 1.6.3
Ignoring rbs-2.7.0 because its extensions are not built. Try: gem pristine rbs --version 2.7.0
@k0kubun (Takashi Kokubun) debug-1.6.3 and rbs-2.7.0 are not bundled versions of Ruby 3.2.0. It may mixed other versions on your environment.
On the other hands, I got the same reports of @olivierlacan's case from @mame (Yusuke Endoh). We are investigating this.
Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago
- Related to Bug #19275: Bundled gems extensions are not installed with 3.2.0 release tarball added
Updated by hsbt (Hiroshi SHIBATA) almost 2 years ago
We have two issues.
- Installation failure of C extension provided by bundled gems.
- Ignore messages will be displayed despite installation successfully.
- I didn't confirm yet.
Updated by mame (Yusuke Endoh) almost 2 years ago
I have created a PR to work around this issue. https://github.com/ruby/ruby/pull/7066
Updated by mame (Yusuke Endoh) almost 2 years ago
- Status changed from Assigned to Closed
Applied in changeset git|4959e01932cf6c4d3e5e90d3e0b4fa780f754fa6.
common.mk: Do not invoke outdate-bundled-gems by default
If baseruby is available (and its version is different from one being
built) when compiling ruby, tool/outdate-bundled-gems.rb (which is
invoked by make install
) wrongly deletes debug.so and rbs_extension.so
in .bundle/extension/*.
This leads to a broken installation of ruby which lacks the libraries,
which may make rubygems show the following warnings (in some additional
complex conditions):
$ irb
Ignoring debug-1.7.1 because its extensions are not built. Try: gem pristine debug --version 1.7.1
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
irb(main):001:0>
According to some committers, tool/outdate-bundled-gems.rb is introduced
for fixing a build issue, but the detail is not recorded. The issue
seems to occur only when debug gem or rbs gem is updated, so it is
difficult to fix the script so soon.
Tentatively, this change stops invoking the script by default.
This should be backported to ruby_3_2.
Fixes [Bug #19271]
Updated by mame (Yusuke Endoh) almost 2 years ago
- Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: REQUIRED
Updated by mame (Yusuke Endoh) almost 2 years ago
Just FYI. Here is an ad-hoc workaround for ruby 3.2.0 tarball.
$ tar xf ruby-3.2.0.tar.gz
$ cd ruby-3.2.0
$ rm tool/outdate-bundled-gems.rb
$ touch tool/outdate-bundled-gems.rb
$ ./configure --prefix=/path/to/ruby/installed/
$ make install
Updated by naruse (Yui NARUSE) almost 2 years ago
- Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: REQUIRED to 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: DONE
ruby_3_2 f7e9b79f815e08e0a29fff11f77466f4ffb92520 merged revision(s) 4959e01932cf6c4d3e5e90d3e0b4fa780f754fa6.
Updated by hsbt (Hiroshi SHIBATA) over 1 year ago
- Related to Bug #19340: Ruby master 'make install' not installing rbs gem added