Skip to content

Restore rb_sys dependency for Rust#9416

Merged
hsbt merged 2 commits into
ruby:masterfrom
bangseongbeom:restore-rb-sys
Mar 30, 2026
Merged

Restore rb_sys dependency for Rust#9416
hsbt merged 2 commits into
ruby:masterfrom
bangseongbeom:restore-rb-sys

Conversation

@bangseongbeom
Copy link
Copy Markdown
Contributor

@bangseongbeom bangseongbeom commented Mar 20, 2026

What was the end-user or developer problem that led to this PR?

After running bundle gem --ext=rust my_gem and bundle install, I got an error when I run bundle exec rake compile (I followed oxidize.rb guide):

$ bundle exec rake compile
rake aborted!
LoadError: cannot load such file -- rb_sys/extensiontask (LoadError)
/.../Rakefile:12:in '<top (required)>'
/.../rake:27:in '<top (required)>'
(See full trace by running task with --trace)

What is your fix for the problem, implemented in this PR?

Revert #8455 partially. In that PR, rb_sys was removed from the dependencies, but it seems to be unintended. Without rb_sys, rb_sys/extensiontask cannot be loaded, so all rake commands cannot be run.

Make sure the following tasks are checked

Copilot AI review requested due to automatic review settings March 20, 2026 17:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores the rb_sys gem dependency in Bundler’s Rust gem scaffolding so the generated Rakefile (which requires rb_sys/extensiontask) works after bundle install, fixing LoadError failures when running tasks like bundle exec rake compile.

Changes:

  • Add rb_sys as a dependency in the Rust newgem gemspec template.
  • Update bundle gem --ext=rust specs to assert the generated gemspec includes rb_sys.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
bundler/spec/commands/newgem_spec.rb Updates Rust scaffold expectations to include an rb_sys dependency in the generated gemspec.
bundler/lib/bundler/templates/newgem/newgem.gemspec.tt Adds rb_sys dependency when generating a gem with --ext=rust.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bundler/lib/bundler/templates/newgem/newgem.gemspec.tt
Comment thread spec/commands/newgem_spec.rb
Comment thread spec/commands/newgem_spec.rb
@hsbt
Copy link
Copy Markdown
Member

hsbt commented Mar 24, 2026

@gjtorikian @ianks What do you think of this proposal?

I removed that depdendency at fb3f1fe.

I understand that I no longer need rb-sys as a rubygem because I build it using Cargo. Is it corrent?

@gjtorikian
Copy link
Copy Markdown
Contributor

As far as I understand, you need both the Ruby rb_sys and the Rust rb-sys for the extension compilation to work.

@hsbt hsbt merged commit 3fbe199 into ruby:master Mar 30, 2026
95 checks passed
hsbt added a commit that referenced this pull request Apr 7, 2026
Restore rb_sys dependency for Rust

(cherry picked from commit 3fbe199)
hsbt added a commit that referenced this pull request Apr 7, 2026
Restore rb_sys dependency for Rust

(cherry picked from commit 3fbe199)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants