Cache Not Updated For Failed Gems
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 4k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 81
Description
Install a gem that has a native extension that fails to build. The example I am using is the debase debugger that ships with RubyMine - it does not build using a mswin build of ruby. This has been true for years (see https://youtrack.jetbrains.com/issue/RUBY-32289/Debase-Fails-with-MSVC).
So what I do is:
cd C:\msys64\usr\local\ruby-3.3.5\lib\ruby\gems\3.3.0\gems\debase-3.0.0.beta.12\exto- Fix the problem
ruby extconf.rbnmake
Then I follow the directions provided by gem help install.
If you correct the compilation errors by editing the gem files you will need
to write the specification by hand. For example:$ gem install some_extension_gem [build fails] Gem files will remain installed in \ /path/to/gems/some_extension_gem-1.0 for inspection. Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out $ [cd /path/to/gems/some_extension_gem-1.0] $ [edit files or what-have-you and run make] $ gem spec ../../cache/some_extension_gem-1.0.gem --ruby > \ ../../specifications/some_extension_gem-1.0.gemspec $ gem list some_extension_gem
This has worked for years (minus an issue a few years ago that I reported and that was fixed - see https://github.com/rubygems/rubygems/issues/4375).
However, with the latest Ruby gems it no longer works because the gem file is not saved to to the cache. Thus this command no longer works:
gem spec ../../cache/some_extension_gem-1.0.gem --ruby
I can workaround it by manually acquiring the gem and then running:
gem spec ../../cache/some_extension_gem-1.0.gem --ruby > \
> ../../specifications/some_extension_gem-1.0.gemspec
However, once that is done I get this error:
Ignoring debase-3.0.0.beta.14 because its extensions are not built. Try: gem pristine debase --version 3.0.0.beta.14
I can then fix this by adding gem.build_complete file to the directory C:\msys64\usr\local\ruby-3.3.6-mswin\lib\ruby\gems\3.3.0\extensions\x64-mswin64-140\3.3.0\debase-3.0.0.beta.14
Then the gem works.
However, this a lot more work than it used to be. Can the old behavior be restored? If not, then gem help --install text should be updated to describe the steps that need to be taken to install broken gems.
Did you try upgrading RubyGems?
This happens on the latest RubyGems, it is a new issue.
Post steps to reproduce the problem
- Install a gem that fails to build an extension
- Fix the gem in-place, build it
- Type
gem help install - The instructions no longer work because the gem is not saved to the cache directory and the extensions directory is not updated.
Versions
gem --version
3.5.22
ruby --version
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x64-mswin64_140]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the gem install failure flow and the instructions shown by gem help install, using the reported failed native-extension scenario on mswin as the reproduction. Inspect how the gem cache and extensions directory are handled after the build fails; done means either restoring the documented recovery flow or updating gem help install to match the current required steps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100