Open Stranger6667 opened 2 days ago
In your gemspec you've set ext/css_inline/extconf.rb
as the config for the extension. RubyGems recognises the 'extconf' file name, and will run your extconf.rb
to produce a makefile, and then execute the makefile to compile the extension.
In ext/css_inline/extconf.rb
you require mkmf
and rb_sys/mkmf
(mkmf is short for 'make makefile'). mkmf
is part of the ruby standard library, but rb_sys/mkmf
is from the rb_sys gem. Back to your gemspec, you list rb_sys as a development dependency. Development dependencies aren't installed along with gem install css_inline
, so when installing your gem on a system that doesn't already have rb_sys you get the error cannot load such file -- rb_sys/mkmf (LoadError)
If you changed spec.extensions = ["ext/css_inline/extconf.rb"]
to spec.extensions = ["ext/css_inline/Cargo.toml"]
RubyGems would instead invoke cargo directly to compile the extension. With this extconf.rb
is no longer needed. The downside is this requires RubyGems 3.3.26 or greater.
Alternately you could change spec.add_development_dependency "rb_sys", "~> 0.9"
to spec.add_dependency "rb_sys", "~> 0.9"` so that rb_sys will also be installed along with your gem.
You'll see some gems with both an extconf.rb
and spec.extensions
set to the Cargo.toml
. This allows the gem to be installed by end users without rb_sys, but also allows using rb_sys/extconf in development for the integration with Rake via rake/extensiontask
.
It looks like once the missing rb_sys issue is resolved you'd run in to your extension's Cargo.toml using a relative path to the css-inline crate, and that path isn't packaged with the gem, so the cargo build fails. Removing the path and setting a version so that the dependency is pulled from crates.io should fix that.
Hey!
In css-inline I have the following
extconf.rb
that follows the examples in themagnus
repo:This works on x86 / glibc but doesn't on musl:
So, there is an error:
Ref: original issue in css-inline
Steps to reproduce
1. Dockerfile
2. Shell
3. Command
I am not sure at what layer the problem comes from, but would appreciate any clues.
Thanks