However, when structuring my gem that way I get an error because rb_sys appears to expect a Cargo.toml to be found in the top-level directory. I don't mind putting one there, but I'm curious why the example is there without it. Is there something I could do to not need a top-level Cargo.toml?
$ rake --tasks
rake aborted!
RbSys::CargoMetadataError: Could not infer Rust crate information using `cargo metadata`. Original error was: RuntimeError: exited with non-zero status (pid 39361 exit 101) Things to check: - Check that your ext/*/Cargo.toml at is valid - If you are using a workspace, make sure you are the root Cargo.toml exists - Make sure `cargo` is installed and in your PATHStderr from `cargo metadata` was:
error: could not find `Cargo.toml` in `/Users/me/Code/my_gem` or any parent directory
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:154:in `rescue in cargo_metadata'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:141:in `cargo_metadata'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:136:in `package_metadata'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:76:in `manifest_path'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:48:in `manifest_directory'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/extensiontask.rb:33:in `init'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rake-compiler-1.2.7/lib/rake/baseextensiontask.rb:29:in `initialize'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/extensiontask.rb:26:in `initialize'
/Users/me/Code/my_gem/Rakefile:7:in `new'
/Users/me/Code/my_gem/Rakefile:7:in `<top (required)>'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/Users/me/.rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `eval'
/Users/me/.rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `<main>'
Caused by:
exited with non-zero status (pid 39361 exit 101)
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:149:in `cargo_metadata'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:136:in `package_metadata'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:76:in `manifest_path'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/cargo/metadata.rb:48:in `manifest_directory'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/extensiontask.rb:33:in `init'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rake-compiler-1.2.7/lib/rake/baseextensiontask.rb:29:in `initialize'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rb_sys-0.9.98/lib/rb_sys/extensiontask.rb:26:in `initialize'
/Users/me/Code/my_gem/Rakefile:7:in `new'
/Users/me/Code/my_gem/Rakefile:7:in `<top (required)>'
/Users/me/.rvm/gems/ruby-3.1.3/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/Users/me/.rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `eval'
/Users/me/.rvm/gems/ruby-3.1.3/bin/ruby_executable_hooks:22:in `<main>'
(See full trace by running task with --trace)
Is there something in my gemspec or Rakefile I need to set to tell it where my Cargo.toml is?
yeah... that example isnt really good for modelling a real gem. it's more of a test fixture honestly. would love to rename the dir. https://github.com/oxidize-rb/oxi-test is better
I'm trying to start a new rb-sys-based gem, and thought I should use the example structure here: https://github.com/oxidize-rb/rb-sys/tree/main/examples/rust_reverse
However, when structuring my gem that way I get an error because rb_sys appears to expect a
Cargo.toml
to be found in the top-level directory. I don't mind putting one there, but I'm curious why the example is there without it. Is there something I could do to not need a top-level Cargo.toml?Here's the current structure:
When I run
rake --tasks
, I get this output:Is there something in my gemspec or Rakefile I need to set to tell it where my Cargo.toml is?