gjtorikian / commonmarker

Ruby wrapper for the comrak (CommonMark parser) Rust crate
MIT License
416 stars 80 forks source link

Building native extensions fails (on Ruby 3.3.0) #268

Closed mvz closed 5 months ago

mvz commented 6 months ago

I'm getting a failure when trying to install version 1.0.3 on Ruby 3.3.0:

  thread 'main' panicked at 'generate bindings: ClangDiagnostic("/home/matijs/.rbenv/versions/3.3.0/include/ruby-3.3.0/ruby/ruby.h:23:10: fatal error: 'stdarg.h' file not found\n")', /home/matijs/.cargo/registry/src/github.com-1ecc6299db9ec823/rb-sys-0.9.85/build/main.rs:55:6

I don't know if the Ruby version is relevant, since installing on older Rubies just downloads the native gem from rubygems.

I do not yet know enough about rb_sys to debug this, so any pointers to what I should try or check are appreciated.

mvz commented 6 months ago

I figured it out: I needed to install the libclang-dev package. I've created a new issue in rb-sys asking for better documentation on this: https://github.com/oxidize-rb/rb-sys/issues/300.

gjtorikian commented 5 months ago

When installing the version, you shouldn't need to compile the binaries. We ought to precompile them for you, based on your OS. See https://github.com/flavorjones/ruby-c-extensions-explained#strategy-3-precompiled for what that looks like in practice (albeit for C based gems, not Rust ones, the concept is the same).

But, I am currently waiting for https://github.com/oxidize-rb/rb-sys/pull/298 to be released to ensure that every build dependency supports Ruby 3.3.

gjtorikian commented 5 months ago

xref #270