Closed flavorjones closed 2 years ago
Note that #30 takes the approached mentioned last above, passing just --libs
to pkg-config and hardcoding -lz
.
I'm working on a PR to send upstream to Ruby for mkmf pkg-config support.
Thanks @flavorjones! That seems like the right approach. I don't see a way to inject multiple arguments now.
See upstream PR at https://github.com/ruby/ruby/pull/5436. If that goes green I'll open a new issue at https://bugs.ruby-lang.org/ for review.
Hi @flavorjones,
Thank you for the heads up! And for working towards a fix (both here and in the upstream Ruby). I really appreciate that!
@stanhu thank you for looking into this!
I had a brief look a the pkg-config
Ruby Gem, however, it does not offer what we need here.
PR submitted upstream at https://bugs.ruby-lang.org/issues/18490
The upstream PR has been merged into 3.2.0.dev / ruby head. I've updated #32 to only monkeypatch Ruby 3.1.x.
I started working on adding native (precompiled) support for Ruby 3.1. Unfortunately it appears that Ruby 3.1 introduced a change that breaks how we use
mkmf
'spkg_config
method, so I'm creating this issue to make that issue visible.In summary, ruby-magic's extconf.rb was relying on the ability to pass multiple flags:
https://github.com/kwilczynski/ruby-magic/blob/f1a875bfdf0f6f78d1a337879fa4436bf3512031/ext/magic/extconf.rb#L299-L301
Unfortunately, this commit in Ruby breaks the behavior we were relying on:
https://github.com/ruby/ruby/commit/dff8d12
and so as a result, the build breaks with this error output:
and the contents of
mkmf.log
are:I think the right thing to do is to submit a PR upstream to Ruby to allow passing multiple options to
pkg_config
, but that will take some time. We could also monkeypatchpkg_config
but it's a rather long and complicated method and so that may be a bit risky.I'm curious if anybody has any other clever ideas for working around this? I do believe we need to pass both
--libs
and--static
to pkg_config to get the right flags for the ruby-magic build, though I guess we could work around it for now by passing just--libs
and then hardcoding-lz
.