Skip to content

Conversation

alto-ruby
Copy link
Contributor

@alto-ruby alto-ruby commented Jul 9, 2023

Custom strip invalidates the signature, caused the arm64-darwin gem failed to run on M1 macs.
Error in mac console: Exception Type: EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))

Warning in gem build log:

# linking shared-object grpc/grpc_c.bundle
# Stripping grpc_c.bundle
# /opt/osxcross/target/bin/aarch64-apple-darwin20.2-strip: warning: changes being made to the file will invalidate the code signature in: /Users/jeff/work/ruby/grpc/tmp/arm64-darwin/grpc_c/3.2.0/grpc_c.bundle

Custom stripping is not really needed (any more), this diff removes it from src/ruby/ext/grpc/extconf.rb, the gem artifact size didn't change and arm64-darwin gem runs fine on M1 mac.

fixes: #28631
fixes: #29100

@alto-ruby alto-ruby changed the title remove explicit strip in ruby ext conf [Ruby] remove explicit strip in ruby ext conf Jul 9, 2023
@alto-ruby alto-ruby force-pushed the ruby-no-strip-in-ext-conf branch from de22278 to f37c483 Compare July 9, 2023 01:16
@alto-ruby alto-ruby changed the title [Ruby] remove explicit strip in ruby ext conf [Ruby] remove manual strip in ruby ext conf Jul 9, 2023
@alto-ruby alto-ruby marked this pull request as ready for review July 10, 2023 01:39
@alto-ruby alto-ruby added the release notes: no Indicates if PR should not be in release notes label Jul 10, 2023
@alto-ruby alto-ruby force-pushed the ruby-no-strip-in-ext-conf branch from f37c483 to f2378b6 Compare July 10, 2023 02:12
@alto-ruby alto-ruby enabled auto-merge (squash) July 10, 2023 02:12
@alto-ruby alto-ruby merged commit 75ecd17 into grpc:master Jul 17, 2023
@apolcyn
Copy link
Contributor

apolcyn commented Jul 18, 2023

Are we certain that the gem binary size didn't change? (especially on linux x86_64)

@apolcyn apolcyn added release notes: yes Indicates if PR needs to be in release notes and removed release notes: no Indicates if PR should not be in release notes labels Jul 18, 2023
@alto-ruby
Copy link
Contributor Author

Yes, there is the artifact link in the PR summary, the sizes are comparable to the build prior to this PR or the release packages in rubygems.org.
For x86_64-linux specifically, it remains at 17.5MB.

@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Jul 18, 2023
mario-vimal pushed a commit to mario-vimal/grpc that referenced this pull request Jul 27, 2023
Custom strip invalidates the signature, caused the arm64-darwin gem
failed to run on M1 macs.
Error in mac console: `Exception Type: EXC_BAD_ACCESS (SIGKILL (Code
Signature Invalid))`

Warning in gem build log:
```
# linking shared-object grpc/grpc_c.bundle
# Stripping grpc_c.bundle
# /opt/osxcross/target/bin/aarch64-apple-darwin20.2-strip: warning: changes being made to the file will invalidate the code signature in: /Users/jeff/work/ruby/grpc/tmp/arm64-darwin/grpc_c/3.2.0/grpc_c.bundle
```

Custom stripping is not really needed (any more), this diff removes it
from `src/ruby/ext/grpc/extconf.rb`, the [gem
artifact](https://console.cloud.google.com/storage/browser/grpc-testing-kokoro-prod/test_result_public/prod/grpc/core/pull_request/linux/grpc_distribtests_ruby/19833/20230708-181642/github/grpc/artifacts?pageState=(%22StorageObjectListTable%22:(%22f%22:%22%255B%255D%22))&prefix=&forceOnObjectsSortingFiltering=false)
size didn't change and arm64-darwin gem runs fine on M1 mac.

fixes: grpc#28631
fixes: grpc#29100
@flavorjones
Copy link
Contributor

flavorjones commented Aug 10, 2023

Please note that I'm in the process of fixing stripping upstream in rake-compiler-dock ... rake-compiler/rake-compiler-dock#104

I could have fixed it sooner if someone had filed an issue! 🤷

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.

(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) on apple M1 chip 1.43.1 seems to use universal gem on mac arm
4 participants