-
Notifications
You must be signed in to change notification settings - Fork 88
(maint) Use packaged libxml to build nokogiri on MacOS #832
(maint) Use packaged libxml to build nokogiri on MacOS #832
Conversation
configs/components/_base-rubygem.rb
Outdated
pkg.install do | ||
"#{settings[:gem_install]} #{name}-#{version}.gem" | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a placeholder, I think the long term solution is to change this to just add to the install command something like #{pkg.gem_install_options}
, where we define the pkg.gem_install_options in the nokogiri component.
I can't quite wrap my head around how to implement this yet though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option to "pass" additional options is to define something like this in _base-rubygem.rb
:
pkg.install do
if gem_install_options
"#{settings[:gem_install]} #{name}-#{version}.gem -- #{gem_install_options}"
else
"#{settings[:gem_install]} #{name}-#{version}.gem"
end
end
And then in rubygem-nokogiri.rb
specify the options prior to instance_eval'ing the base component:
gem_install_options = "--use-system-libraries --with-xml2-lib=... --with-xml2-include=... etc"
instance_eval File.read('configs/components/_base-rubygem.rb')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Josh, took a bit to wrap my head around things but the prior to the instance_eval was the key point. I've pushed up my changes. Working on last little bit now, vanagon-generic-job is failing osx-12-arm, which is cross compiled.
Here is my current work in progress for runtime, the otool output for the nokogiri bundle:
This looks right when compared to the same output on the currenty nightly osx-13-arm64 output:
Note in my work in progress we see the libxml2 and libxslt are using the bundled libraries in my work in progress, and in comparission the current nightlies as expected does not load our bundled libraries. Now where things look wrong is when running the Nokogiri binary, this is how it the binary looks when run from the current nightly build:
Things to note in the current nightly build above, the vendored libxml is used but the system libxslt is used. The goal of this ticket is to get the libxslt to use our libxslt.
First there is an obvious warning message about libxml, then we see that the system libxml and system libxslt are being used. That seems to be a problem. |
I think the nightly version is correctly using the libxml2 headers that are vendored in the nokogiri gem as can be seen by this entry in
But the work is progress seems to be using You can go full explicit mode and list the include and lib directories for each component like:
Can also use |
Awesome Josh, thank you. going explicit worked:
|
d5172ce
to
b7195cc
Compare
This PR changes the gem install command for the Nokogiri gem. Currently when building nokogiri it uses the system libxml2 and libxslt. We now will pass in an option in the `gem install` command to use the expected libraries. Also on MacOS we now set the 'pkgconfig' path as an env variable when building Nokogiri.
b7195cc
to
5f202ab
Compare
I've removed the block label, validation for this is complete. Here is the agent-runtime-main vanagon generic job link: https://jenkins-platform.delivery.puppetlabs.net/view/vanagon-generic-builder/job/platform_vanagon-generic-builder_vanagon-packaging_generic-builder/2907/ (ignore the one failure, that is an AWS transient) |
This PR changes the gem install command for the Nokogiri gem. Currently when building nokogiri it uses the system libxml2 and libxslt. We now will pass in an option in the
gem install
command to use the expected libraries.