cabo / kramdown-rfc

An XML2RFC (RFC799x) backend for Thomas Leitner's kramdown markdown parser
MIT License
189 stars 80 forks source link

Dependency on strscan #235

Open martinthomson opened 2 months ago

martinthomson commented 2 months ago
#9 18.89 Installing unicode-name 1.12.0
#9 19.08 Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
#9 19.08 
#9 19.08     current directory: /usr/lib/ruby/gems/3.3.0/gems/strscan-3.1.0/ext/strscan
#9 19.08 /usr/bin/ruby extconf.rb
#9 19.08 mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

-- https://github.com/martinthomson/i-d-template/actions/runs/9547354420/job/26312195940#step:7:437

This seems to be a common pattern. A consequence of the "batteries included" design philosophy.

(I'm tempted to ask: Is there any way to just get kramdown-rfc without the full suite of secondary tools? That's not necessarily a good question, but it might help here.)

cabo commented 2 months ago

This problem was recently fixed. Can you do this with a recent version of kramdown-rfc?

cabo commented 2 months ago

(kramdown-rfc uses REXML in a number of places, which is the pure-ruby XML library. REXML uses strscan, which is a default gem, but was misconfigured to require a build anyway.) This was worked around by the emergency fix in 1.7.15. I can't see which version of kramdown-rfc you are trying to install. Please install 1.7.17.

cabo commented 2 months ago

Interesting. bundle does something that gem doesn't. Need to understand this some more.

cabo commented 2 months ago

The sheer fact that REXML now declares its dependency on strscan seems to be the problem. This Gemfile works for me:

source 'https://rubygems.org'

gem 'kramdown-rfc'
gem 'rexml', '<= 3.2.6'

(The gem 'net-http-persistent' is no longer needed as kramdown-rfc now requires that; it no longer supports platforms old enough to not have gem 'net-http-persistent')

A simple "gem install kramdown-rfc" also works as it doesn't invoke the bundler functionality.

kesara commented 2 months ago

With author tools (using bundle), it seems to install strscan as dependency for kramdown.

2.621 In Gemfile:
2.621   kramdown-rfc was resolved to 1.7.17, which depends on
2.621     kramdown-rfc2629 was resolved to 1.7.17, which depends on
2.621       kramdown-parser-gfm was resolved to 1.1.0, which depends on
2.621         kramdown was resolved to 2.4.0, which depends on
2.621           rexml was resolved to 3.3.0, which depends on
2.621             strscan

And fails to install strscan.

cabo commented 2 months ago

I'm trying to avoid pinning rexml in the gem, as that makes it hard to install in some other environments. So until the rexml people can get their act together, can you do the above addition to the Gemfile instead?

cabo commented 2 months ago

(In authortools, you could also simply add build-essentials.)

kesara commented 2 months ago

I had to install ruby-dev in addition to build-essential on ubuntu:jammy.