Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native gems: create releases for additional darwin platforms #2079

Closed
flavorjones opened this issue Sep 8, 2020 · 16 comments
Closed

Native gems: create releases for additional darwin platforms #2079

flavorjones opened this issue Sep 8, 2020 · 16 comments
Labels
packaging/native-gem release-blocker Blocking a milestone release
Milestone

Comments

@flavorjones
Copy link
Member

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).

@flavorjones
Copy link
Member Author

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

@drbrain
Copy link
Member

drbrain commented Sep 8, 2020

Here are the available macOS versions on Travis-CI

@flavorjones
Copy link
Member Author

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

@flavorjones
Copy link
Member Author

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

@flavorjones
Copy link
Member Author

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.

@flavorjones
Copy link
Member Author

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

@flavorjones
Copy link
Member Author

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.

@flavorjones
Copy link
Member Author

@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

?

@odlp
Copy link

odlp commented Sep 14, 2020

@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

@flavorjones
Copy link
Member Author

@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!

@flavorjones
Copy link
Member Author

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

@flavorjones
Copy link
Member Author

Also, please see #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!

@deepj
Copy link

deepj commented Dec 25, 2020

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

@flavorjones
Copy link
Member Author

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

@flavorjones
Copy link
Member Author

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.

@deepj
Copy link

deepj commented Dec 30, 2020

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

flavorjones added a commit that referenced this issue Dec 31, 2020
Cross compile for x86_64-darwin and arm64-darwin per rake-compiler-dock

---

This requires latest rake-compiler-dock from master branch.

**What problem is this PR intended to solve?**

Fat binary gems for MacOS are currently built on MacOS native. This complicates the build and release cycle. It is desirable to build all binary gems per cross compiler.

Related to #2079

**Have you included adequate test coverage?**

No CI, but I tested the resulting `x86_64-darwin` gem on MacOS-10.14.4 with both the system ruby-2.3.7 (after extending the `required_ruby_version` of nokogiri) and ruby-2.7.2 installed per rvm. The Mac is running on https://github.com/foxlet/macOS-Simple-KVM .

I'm unable to execute the `arm64-darwin` on any computer. I just did some static inspection of the built `nokogiri.bundle` file.

**Does this change affect the behavior of either the C or the Java implementations?**

C only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packaging/native-gem release-blocker Blocking a milestone release
Projects
None yet
Development

No branches or pull requests

4 participants