Skip to content

Commit

Permalink
Fix Rosetta2 CocoaPods warning on Apple Silicon (#32498)
Browse files Browse the repository at this point in the history
Summary:
The current warning assumes the ruby binary to be single arch, but the ruby version shipping with macOS is universal `universal.arm64e-darwin20`. This PR changes the check to search for `arm64` in any position instead of just the beginning to fix false positives.

## Changelog

[iOS] [Fixed] - Fix Rosetta2 CocoaPods warning on Apple Silicon

Pull Request resolved: #32498

Test Plan:
### Before
On M1 Mac `pod install` using system ruby always yields a warning.

### After
`pod install` does not yield a warning.
`arch -x86_64 pod install` yields a warning.

Reviewed By: fkgozali

Differential Revision: D32013176

Pulled By: sota000

fbshipit-source-id: 84f517c210318b5d073d161b6849b9aee367bba6
  • Loading branch information
oblador authored and facebook-github-bot committed Nov 4, 2021
1 parent 3b7044d commit e918362
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def use_react_native! (options={})
# Include Hermes dependencies
hermes_enabled = options[:hermes_enabled] ||= false

if `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i == 1 && !RUBY_PLATFORM.start_with?('arm64')
if `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i == 1 && !RUBY_PLATFORM.include?('arm64')
Pod::UI.warn 'Do not use "pod install" from inside Rosetta2 (x86_64 emulation on arm64).'
Pod::UI.warn ' - Emulated x86_64 is slower than native arm64'
Pod::UI.warn ' - May result in mixed architectures in rubygems (eg: ffi_c.bundle files may be x86_64 with an arm64 interpreter)'
Expand Down

0 comments on commit e918362

Please sign in to comment.