nokogiri icon indicating copy to clipboard operation
nokogiri copied to clipboard

[install/bug] Alternate toolchain specified in ENV works, but does not work when passed as build arguments

Open ziggythehamster opened this issue 11 months ago • 1 comments

Have you read and followed the installation tutorial at http://www.nokogiri.org/tutorials/installing_nokogiri.html?

  • [x] Yes!

We are using a non-default toolchain, so e.g. ld is available at gcc10-ld. For most gems with native code, they either use RbConfig to locate the toolchain (RbConfig::CONFIG['LD'] # => "gcc10-ld") or allow you to specify them as build arguments, e.g. gem install foo -- LD=gcc10-ld or bundle config build.foo LD=gcc10-ld. Nokogiri seems to pass along CC but won't pass along LD or AR to the libxml2 build.

Nokogiri will pass these along if they are defined in ENV, however.

This results in this not working:

gem install --platform ruby nokogiri -- AR=gcc10-ar CC=gcc10-cc CXX=gcc10-c++ LD=gcc10-ld

But this works:

AR=gcc10-ar CC=gcc10-cc CXX=gcc10-c++ LD=gcc10-ld gem install --platform ruby nokogiri

The former would be preferred, because I can configure BUNDLE_BUILD__NOKOGIRI in the "user" bundler config file to correctly specify these. The latter requires someone who is bundle install'ing to specify the toolchain (which they should not need to know about).

I think that this would be a rather simple change to extconf.rb, but I'm not sure if this would be an accepted change or not.

ziggythehamster avatar Mar 18 '24 17:03 ziggythehamster

@ziggythehamster Thanks for opening this, I think this is just an oversight. I would absolutely review to a PR to pass these other values through!

flavorjones avatar Mar 19 '24 02:03 flavorjones

A fix for this was merged in #3165! Thanks, @ziggythehamster!

flavorjones avatar Jul 03 '24 19:07 flavorjones