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

Add fat binary gem support for ruby-3.1 #2409

Merged
merged 9 commits into from Jan 6, 2022

Conversation

larskanis
Copy link
Member

@larskanis larskanis commented Jan 4, 2022

Ruby-3.1-x64 on Windows has a changed platform string "x64-mingw-ucrt" vc. "x64-mingw32".
Consequentally rake-compiler-dock has a new corresponding platform image.
See https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html

Unfortunately the compiler triplet is still "x86_64-w64-mingw32" for both ruby platforms, although the compiled code isn't compatible.
Therefore we have to differ by RUBY_PLATFROM instead of the "host" string.

What problem is this PR intended to solve?

It shall add binary gems for ruby-3.1.

Have you included adequate test coverage?

This is another PR #2408

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

C only.

Fixes #2397

@flavorjones
Copy link
Member

@larskanis Thanks so much for shipping this. I'm going to merge #2408 and rebase this on top of it.

@larskanis
Copy link
Member Author

Oh, I just noticed that arm64-darwin doesn't build. I'll update the PR.

@flavorjones
Copy link
Member

flavorjones commented Jan 4, 2022

@larskanis Can you please peek at 0c32749 and tell me if that Windows ucrt test for the native gem looks right?

@flavorjones
Copy link
Member

flavorjones commented Jan 4, 2022

@larskanis Not sure if you're actively working on this, I don't want to clobber any work you're doing ...

@flavorjones
Copy link
Member

flavorjones commented Jan 4, 2022

@larskanis So this change broke some things:

-    # Prefer host_alias over host in order to use i586-mingw32msvc as
-    # correct compiler prefix for cross build, but use host if not set.
-    recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
+    recipe.host = RbConfig::CONFIG["host"]

An example is how we derive the name of the "ar" tool for building libgumbo (with this change, we end up looking for the nonexistent x86_64-redhat-linux-gnu-ar instead of x86_64-redhat-linux-ar).

I'm not familiar with why this particular change was made, and I wish we were collaborating more closely on these changes. Can you help me understand why this change was made and whether I can safely revert it (it seems to work fine when I do)?

@flavorjones
Copy link
Member

@larskanis I'm going to step away for the evening, but I will have time tomorrow to collaborate -- in real time -- if you're willing and able to. Thanks for working on this!

@larskanis larskanis force-pushed the cross-ruby-3.1 branch 6 times, most recently from dc70fd5 to 84b350c Compare January 5, 2022 10:35
@larskanis
Copy link
Member Author

Tests look good now. I don't understand the JRuby install error. It looks like jruby/jruby#6904 . I tried to use ruby-maven from git, but to no avail.

@flavorjones
Copy link
Member

Thank you! I have some context on the JRuby thing, I'll take a look this morning.

larskanis and others added 3 commits January 5, 2022 09:27
Ruby-3.1-x64 on Windows has a changed platform string "x64-mingw-ucrt" vc. "x64-mingw32".
Consequentally rake-compiler-dock has a new corresponding platform image.
See https://rubyinstaller.org/2021/12/31/rubyinstaller-3.1.0-1-released.html

Unfortunately the compiler triplet is still "x86_64-w64-mingw32" for both ruby platforms, although the compiled code isn't compatible.
Therefore we have to differ by RUBY_PLATFROM instead of the "host" string.
@flavorjones flavorjones force-pushed the cross-ruby-3.1 branch 3 times, most recently from 50bbc4f to 6c19e2b Compare January 5, 2022 17:23
@flavorjones
Copy link
Member

@larskanis rake-compiler sets the gemspec required_ruby_version to

spec.required_ruby_version = [
  ">= #{ruby_api_version(sorted_ruby_versions.first)}",
  "< #{ruby_api_version(sorted_ruby_versions.last).succ}.dev"
]

(see https://github.com/rake-compiler/rake-compiler/blob/master/lib/rake/extensiontask.rb#L282-L285)

For Nokogiri this will always be [">= 2.6", "< 3.2.dev"], which is incorrect for the windows gems now. I've patched it up locally in 56b89d9 but I'd like to understand if we should be using rake-compiler differently to make this happen automatically (or if we should add a feature to rake-compiler to do so).

@larskanis
Copy link
Member Author

For Nokogiri this will always be [">= 2.6", "< 3.2.dev"], which is incorrect for the windows gems now.

I opened rake-compiler/rake-compiler#199 to fix this issue in rake-compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ship Ruby 3.1 precompiled native support
2 participants