Closed SlashScreen closed 1 year ago
Hey, thanks for reporting this issue.
This looks like it is a problem building rb-sys
. rb-sys
is the low-level bindings direct to Ruby's C API and handles linking to Ruby (Magnus is a nice easy-to-use layer on top). You might get better help reporting this kind of issue there, though that project's maintainer, @ianks, is super helpful, so if I @ mention him here he might be happy to help you out here.
I can take a first stab at helping. The error seems to be it can't find the Ruby header file, ruby.h
. Guessing from the file paths it looks like the error message is from a linux system with a Ruby installed via the distributions package manager? Many distributions have separate packages for the ruby
binary and the Ruby headers, for example on Ubuntu there's the ruby
package and then the headers are part of the ruby-dev
package. Do you have ruby-dev
(or your distribution's equivalent) installed?
Oh, yes, I do believe I have ruby-dev installed, and both are installed via apt, if remember correctly (ubuntu).
Humm, I'm not really sure why else it wouldn't find the Ruby headers.
rb-sys
is running bindgen (which calls clang), and giving it the paths /usr/include/ruby-3.0.0
and /usr/include/x86_64-linux-gnu/ruby-3.0.0
to look for Ruby's headers. It gets these by asking Ruby, you can query the same thing with:
ruby -e 'p RbConfig::CONFIG.values_at("rubyhdrdir", "rubyarchhdrdir")'
Does the result of that match up with the directories in the error message? Is there actually a ruby.h
in one of those directories?
Also, have you tried installing any Ruby C extension gems on this system, does that work? fast_blank is a good one to try, it's simple enough that there's not too many ways it could break, and it don't have pre-compiled versions so you could be sure it's building on your machine.
I figured it out! I thought I had ruby-dev installed on this system, but I didn't. the rust build seems to pass now. Note to self: ruby-dev is not a gem. I figured it out while trying and failing to install fast_blank. thank you for your help!
Great! I'm happy to have been of help.
Note to anybody else having issues with this: If you're getting "error linking with cc" issues, just delete the target directory and have rust rebuild.
Attempting to use this crate with the embed feature results in the following stack trace:
At first, I got errors about bindgen not finding clang, but after installing as per bindgen's instructions, it started saying these things. I did a sanity heck by running the same setup process on my linux machine, with the same result. I'm not sure how far down the chain of command this is, so I'm opening an issue here to get some pointers in the right direction.