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

Ruby: Output a single binary file per platform-specific gem #30935

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

johnnyshields
Copy link
Contributor

@johnnyshields johnnyshields commented Sep 10, 2022

Fixes #30933 related to Ruby UCRT build.

Note that this reverts the UCRT CPP flag change in #31051 because it's no longer needed.


In #30933, I discovered the Ruby UCRT gem attempting to load the MSVCRT binary, and failing because that binary file is a zero-byte placeholder. Specifically, the gem root dir looks like this:

grpc_c.32-msvcrt.ruby - 0 KB
grpc_c.64-msvcrt.ruby - 0 KB
grpc_c.64-ucrt.ruby - 9,650 KB

It would be possible to fix the reference so the UCRT binary is loaded (probably a C build flag issue), however...

Rather than having 3 binaries files (1 real + 2 placeholders), the most elegant solution is to only create 1 binary file for each platform-specific, named grpc_c.ruby, which is:

  • On Windows: the correct binary file for the given Windows architecture
  • On Linux/Mac: a 0-byte placeholder

For reference, the UCRT gem root dir will now look like this:

grpc_c.ruby - 9,650 KB

This solution unambiguously avoids loading the wrong binary, and also gets rid of a lot of cruft in the build code at the same time. Obviously we'll never need more than one grpc_c binary for any given platform gem.

@johnnyshields johnnyshields changed the title Build a single binary file per Ruby platform-specific gem. … Build a single binary file per Ruby platform-specific gem Sep 10, 2022
@johnnyshields johnnyshields changed the title Build a single binary file per Ruby platform-specific gem Ruby: Build a single binary file per platform-specific gem Sep 10, 2022
@johnnyshields johnnyshields changed the title Ruby: Build a single binary file per platform-specific gem Ruby: Output a single binary file per platform-specific gem Sep 11, 2022
@apolcyn apolcyn added kokoro:force-run release notes: yes Indicates if PR needs to be in release notes labels Sep 12, 2022
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 20, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: johnnyshields / name: Johnny Shields (4e35e36)

@johnnyshields
Copy link
Contributor Author

@apolcyn thanks for the fix in v1.49.1. Can you please still look to merge this PR? I think it will simplify things and prevent issues in the future.

@johnnyshields
Copy link
Contributor Author

@apolcyn let's merge this one? Just want to be completely wrapped up on my GRPC work 👍

@apolcyn
Copy link
Contributor

apolcyn commented Oct 11, 2022

Sorry for the delay @johnnyshields. Aiming to go through this this week.

@johnnyshields
Copy link
Contributor Author

@apolcyn pinging on this one.

@stale
Copy link

stale bot commented Jun 18, 2023

This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 30 days. It will be closed automatically if no further update occurs in 7 day. Thank you for your contributions!

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

Successfully merging this pull request may close these issues.

Ruby 1.49.0.pre1 - grpc getting gRPC dynamic C core load error on x64-mingw-ucrt
3 participants