Nokogiri: Native gems: create releases for additional darwin platforms

Created on 8 Sep 2020  Â·  16Comments  Â·  Source: sparklemotion/nokogiri

Nokogiri v1.11.0.rc3 only supports OSX x86_64-darwin19 platform.

At least one commented at #2075 has asked about x86_64-darwin18. If that's a common platform we should consider shipping that, as well.

I'll be honest and say that my inability to virtualize OSX is a real challenge here. I have a work laptop that's darwin19, and I have an 2009 mac mini that might have darwin18 on it (which looks like it's x86_64).

packaginnative-gem release-blocker

All 16 comments

Note that @drbrain says: "Travis has older Xcode for linking on older Darwin, I use it for building work stuff for MacOS" at https://twitter.com/drbrain/status/1303369620099751936

It looks like this might be helpful, too: https://github.com/tpoechtrager/osxcross which is a cross-compiler toolchain for OSX.

@luislavena I'm going to use osxcross to experiment with creating a rake-compiler-dock-compatible image for OSX!

Example of how this was used in the past in a docker container: https://github.com/hone/mruby-cli-docker/blob/master/Dockerfile which is used by the https://github.com/hone/mruby-cli project.

Aaaand a more complete Dockerfile using osxcross at https://github.com/appPlant/docker-images/blob/mruby-cli/Dockerfile

Did some poking around this morning. I noticed that the grpc gem only ships a universal-darwin gem, and that this Just Worksâ„¢ on my mac running either ruby universal.x86_64-darwin19 or x86-64-darwin19. This works because of this logic in Gem::Platform.

Lesson: we don't need to ship individual gem files for each version of darwin.

Next step: let's take a look at how grpc is built. Optionally consider setting up osxcross in a linux container.

@odlp - I've created a universal-darwin gem and put it in a public storage bucket here:

https://storage.googleapis.com/nokogiri-org-concourse/test-gems/nokogiri-1.11.0.rc3-universal-darwin.gem

Can I ask that you try this on your darwin18 system by:

  • downloading the file from there,
  • check the md5 checksum is f8eb952cdad60740e6d411b40241aade,
  • run gem install --local path/to/nokogiri-1.11.0.rc3-universal-darwin.gem
  • run nokogiri -v

?

@flavorjones works for me! Output from nokogiri -v:

# Nokogiri (1.11.0.rc3)
    ---
    warnings: []
    nokogiri: 1.11.0.rc3
    ruby:
      version: 2.6.5
      platform: x86_64-darwin18
      gem_platform: x86_64-darwin-18
      description: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
      engine: ruby
    libxml:
      source: packaged
      patches:
      - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
      - 0002-Remove-script-macro-support.patch
      - 0003-Update-entities-to-remove-handling-of-ssi.patch
      - 0004-libxml2.la-is-in-top_builddir.patch
      - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch
      compiled: 2.9.10
      loaded: 2.9.10
    libxslt:
      source: packaged
      patches: []
      compiled: 1.1.34
      loaded: 1.1.34

@odlp Awesome! Thank you so much for giving it a try, this is really good news. Look for an official universal-darwin gem in RC4!

Closing this because no additional work is needed, and I'm planning an RC4 release today or tomorrow.

Also, please see https://github.com/sparklemotion/nokogiri/pull/2142 which pulls in the new Darwin cross-compilation functionality of rake-compiler-dock. We'll have arm64 native gems in the next RC. If anybody wants to help test ARM, let me know!

@flavorjones Hello, I'd be happy to test ARM64 version on my recent application. Is it possible to release RC4 with ARM64 support?

@deepj yes, RC4 will ship an arm64 native gem that you can test. I'm hoping that will be today or tomorrow.

Hey all - v1.11.0.rc4 has been released with pre-compiled native gem support for arm64-darwin. If you get a chance, please kick the tires and let me know here or at #2075 how it goes for you.

gem install nokogiri --prerelease should result in seeing something like:

$ gem install nokogiri --prerelease
Fetching nokogiri-1.11.0.rc4-x86_64-darwin.gem
Successfully installed nokogiri-1.11.0.rc4-x86_64-darwin
1 gem installed

except, you know, it should say arm64-darwin instead of x86_64-darwin.

@flavorjones I can confirm it works smoothly for me. Thank you!

Was this page helpful?
0 / 5 - 0 ratings