kramdown-rfc icon indicating copy to clipboard operation
kramdown-rfc copied to clipboard

Dependency on strscan

Open martinthomson opened this issue 1 year ago • 8 comments

#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.)

martinthomson avatar Jun 17 '24 12:06 martinthomson

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

cabo avatar Jun 17 '24 12:06 cabo

(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 avatar Jun 17 '24 12:06 cabo

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

cabo avatar Jun 17 '24 12:06 cabo

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.

cabo avatar Jun 17 '24 13:06 cabo

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.

kesara avatar Jun 17 '24 22:06 kesara

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 avatar Jun 17 '24 23:06 cabo

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

cabo avatar Jun 17 '24 23:06 cabo

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

kesara avatar Jun 18 '24 00:06 kesara