gjtorikian / commonmarker

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

Won't build with Ruby head #281

Closed MSP-Greg closed 2 months ago

MSP-Greg commented 3 months ago

I've got some code that runs regularly, and I have run it for years with Windows Ruby head (ucrt). I can't build Commonmarker v1.

I then added it to CI (test.yml), and it failed to build on all three platforms. See:

https://github.com/MSP-Greg/commonmarker/actions/runs/8402231998

Not sure if it's considered an issue. I'm not familiar with Rust, so I'm not sure whether it's a Ruby issue or a Commonmarker issue.

gjtorikian commented 3 months ago

Ah, if I had to guess, it's because rb-sys itself doesn't support ruby-head / 3.4: https://github.com/oxidize-rb/rb-sys/blob/ad4f0e5445e860e56c802064ddf49eeabe1054e8/.github/workflows/ci.yml#L37

@ianks Does that sound right to you? (Note that this is not me asking for 3.4/head support, just wondering if that's a plausible reason for this.)

MSP-Greg commented 3 months ago

I just 'copied' the file crates/rb-sys/src/stable_api/ruby_3_4.rs (from ruby_3_23rs) in rb-sys, then ran CI with Ruby head. No OS's passed.

Your guess is probably correct.

ianks commented 3 months ago

Things work perfectly with ruby-head, but you need to enable the stable-api-compiled-fallback in your Cargo.toml feature for it to work. If that's not easy to do, you can also set RB_SYS_STABLE_API_COMPILED_FALLBACK=true as an env var.

gjtorikian commented 3 months ago

Got it, thank you! For reference here’s the source PR: https://github.com/oxidize-rb/rb-sys/pull/229

@MSP-Greg see if that works out for you. To be honest, I don’t really feel comfortable officially supporting ruby-head myself; I’m just one extremely busy person and the idea of opening the door to unofficial Ruby releases already stresses me out. 😆 But if you want to make a case for why it should be supported I am all ears.

Closing this out because I like to keep my issues clean, but we can keep discussing.

ianks commented 3 months ago

@gjtorikian I'd encourage testing against ruby-head to help ruby core develop more easily. We run ruby-head in prod and anytime an extension fails to compile on ruby head, there's a lot of disruption. FWIW, stable-api-compiled-fallback should make it easy, and if not then that's a bug.

gjtorikian commented 3 months ago

Ok, you convinced me! Reopening since there's a task here.

I'll take a PR for this, as I haven't got time to investigate the work. But I'll get to it after I finish #276.

MSP-Greg commented 3 months ago

JFYI, I quickly checked today using RB_SYS_STABLE_API_COMPILED_FALLBACK=true, and that did not work. But, I haven't checked with Ruby 3.3, nor any Ruby version on Ubuntu or macOS.

Or, with Windows locally, it may be some squirrelly build tool issue... More time later in the week.