Skip to content

ruby: build native Darwin gems using rake-compiler-dock#25794

Merged
jtattermusch merged 6 commits intogrpc:masterfrom
flavorjones:flavorjones-build-darwin-using-rake-compiler-dock
Oct 19, 2021
Merged

ruby: build native Darwin gems using rake-compiler-dock#25794
jtattermusch merged 6 commits intogrpc:masterfrom
flavorjones:flavorjones-build-darwin-using-rake-compiler-dock

Conversation

@flavorjones
Copy link
Copy Markdown
Contributor

@flavorjones flavorjones commented Mar 23, 2021

Summary of changes:

  • add x86_64-darwin and arm64-darwin native platforms
  • bump dev dependency on rake-compiler-dock to ~> 1.1 and stop setting no_native on the extension task
  • add shared object files to the Rake CLEAN file list, and remove those files between native gem builds
  • use bundle exec in the RCD container

The first five commits are small prefactors or cleanup; the interesting bit is in the final commit.

Using rake-compiler-dock ("RCD") for these platforms unifies the Darwin native gem build process with the Linux native gems, which should help avoid inconsistencies in packaging that result in issues like the missing Ruby 3.0 binaries in #25060.

Please note that this change leaves the "universal-darwin" platform native gem untouched, but provides a path forward if the project ever decides to drop "universal" binary support.

Related to:

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 23, 2021

CLA Signed

The committers are authorized under a signed CLA.

@apolcyn apolcyn self-assigned this Mar 23, 2021
@apolcyn apolcyn added lang/ruby release notes: yes Indicates if PR needs to be in release notes kokoro:force-run labels Mar 23, 2021
@flavorjones flavorjones force-pushed the flavorjones-build-darwin-using-rake-compiler-dock branch from ef02bf2 to 82e9c2d Compare March 23, 2021 21:54
@casperisfine
Copy link
Copy Markdown
Contributor

in issues
like #25060,

I suppose you meant o link my comment? #25060 (comment) (darwin packages not containing the 3.0 .bundle)

@flavorjones flavorjones marked this pull request as draft March 24, 2021 15:10
@flavorjones flavorjones force-pushed the flavorjones-build-darwin-using-rake-compiler-dock branch from 82e9c2d to 2c312fd Compare March 24, 2021 18:17
@flavorjones
Copy link
Copy Markdown
Contributor Author

This PR now is purely additive: it adds the capability to generate x86_64-darwin and arm64-darwin native gems. The capability still exists for building the universal-darwin native gem ... err, natively ... on a Darwin system; as well as the ability for all supported platforms to compile the gem from source. The PR description has been updated with more details.

@flavorjones flavorjones marked this pull request as ready for review March 24, 2021 18:20
@apolcyn
Copy link
Copy Markdown
Contributor

apolcyn commented Mar 24, 2021

I've kicked off a package build in https://fusion2.corp.google.com/invocations/b10cd119-1278-4530-888d-5d70120ef3b3/targets - after that's done, we should be able to download the new macos packages and test.

@flavorjones
Copy link
Copy Markdown
Contributor Author

@apolcyn The docker images grpctesting/rake_x86_64-darwin and grpctesting/rake_arm64-darwin need to be created (by push_testing_images.sh). I looked but couldn't see a place where this is automated -- is it possible that this is a manual step?

The failure messages I saw were all variations of:

Unable to find image 'grpctesting/rake_x86_64-darwin:e738cc1e6f4dd11445590a3ab81022fd70282395' locally
docker: Error response from daemon: pull access denied for grpctesting/rake_x86_64-darwin, repository does not exist or may require 'docker login'.

@apolcyn
Copy link
Copy Markdown
Contributor

apolcyn commented Mar 25, 2021

@apolcyn The docker images grpctesting/rake_x86_64-darwin and grpctesting/rake_arm64-darwin need to be created (by push_testing_images.sh). I looked but couldn't see a place where this is automated -- is it possible that this is a manual step?

Yes, this is a manual steo done via the tools/dockerfile/push_testing_images.sh script. One needs to have write access to the docker repo though to run that script -- I've ran it, so the docker images should be there now.

Kicked off another package build in https://fusion2.corp.google.com/invocations/b6c8f76a-6d10-4815-9f28-9ce8c5e4e5db/targets

@flavorjones flavorjones force-pushed the flavorjones-build-darwin-using-rake-compiler-dock branch from 2c312fd to 2b56b17 Compare March 25, 2021 17:42
@flavorjones
Copy link
Copy Markdown
Contributor Author

Looks like I needed to also update templates/grpc.gemspec.template with the rake-compiler-dock dependency upgrade. I've pushed that change now.

@flavorjones
Copy link
Copy Markdown
Contributor Author

@apolcyn Would you mind kicking CI again to see if it's green after yesterday's additional fix to the gemspec template?

@flavorjones
Copy link
Copy Markdown
Contributor Author

@apolcyn I'm not sure why these tests failed, and based on what I'm seeing it seems unlikely to have been caused by the changes this PR. Do you have any advice on how to get this green? Is it possible they're flaky failures?

@flavorjones
Copy link
Copy Markdown
Contributor Author

I don't think the remaining failure is related (it appears to be an issue building csharp artifacts).

@flavorjones
Copy link
Copy Markdown
Contributor Author

The CI failure does not seem to be related, I'm guessing network flakiness in ping_pong: Exception in thread "main" java.lang.AssertionError: Timed out waiting for response. I'd be thankful if someone kicked CI to get it green.

@flavorjones flavorjones force-pushed the flavorjones-build-darwin-using-rake-compiler-dock branch from c94b940 to 2bc27ff Compare September 9, 2021 20:07
@flavorjones
Copy link
Copy Markdown
Contributor Author

I've rebased again. I'd be thankful if @apolcyn or @jtattermusch would kick CI.

@jtattermusch
Copy link
Copy Markdown
Contributor

Looks like the linux artifact build now creates the grpc-1.41.0.dev-x86_64-darwin.gem:

https://console.cloud.google.com/storage/browser/grpc-testing-kokoro-prod/test_result_public/prod/grpc/core/pull_request/linux/grpc_build_artifacts/27493/20210910-024653

The grpc-1.41.0.dev-universal-darwin.gem built on by the macos/grpc_build_artifacts is still being built.

@apolcyn since the tests are looking good, do you want to do the final review of this PR?

Failing to remove these files between native builds leads
rake-compiler to establish circular dependencies (which may be a bug
in rake-compiler, but this feels like an easy and good thing to do,
anyway).
There were already "windows" and "bsd" flags, so let's improve
consistency and readability, and set a clear pattern for subsequent
flags.
As of v1.1.0 there's no need to set this explicitly anymore; it will
be true whenever the extension is being built in a RCD container.

See rake-compiler/rake-compiler-dock@362890d
Using RCD for this platform unifies the Darwin native gem build
process with the Linux native gems, which should help avoid
inconsistencies in packaging that result in issues like the missing
Ruby 3.0 binaries in grpc#25060.

Please note that this change leaves the "universal-darwin" platform
native gem untouched, but provides a path forward if the project ever
decides to drop "universal" binary support.

Related to:

- grpc#25429
- grpc#25756
@flavorjones flavorjones force-pushed the flavorjones-build-darwin-using-rake-compiler-dock branch from 2bc27ff to 8aac238 Compare October 16, 2021 14:06
@flavorjones
Copy link
Copy Markdown
Contributor Author

👋 I've rebased this PR onto master again. Can I ask if there is anything that y'all are waiting on me for to get these changes reviewed and potentially merged?

@jtattermusch
Copy link
Copy Markdown
Contributor

@flavorjones sorry for the delay. I started the tests.

Most importantly, we need a review from @apolcyn

Copy link
Copy Markdown
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jtattermusch jtattermusch merged commit 3181f4e into grpc:master Oct 19, 2021
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Oct 19, 2021
@flavorjones
Copy link
Copy Markdown
Contributor Author

Thanks, all! Heads up that I'll be submitting #25992 for arm64 support shortly.

flavorjones added a commit to flavorjones/grpc that referenced this pull request Oct 19, 2021
@flavorjones flavorjones deleted the flavorjones-build-darwin-using-rake-compiler-dock branch October 26, 2021 17:55
flavorjones added a commit to flavorjones/grpc that referenced this pull request Oct 26, 2021
jtattermusch pushed a commit that referenced this pull request Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

imported Specifies if the PR has been imported to the internal repository lang/ruby release notes: yes Indicates if PR needs to be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants