소개
❯ pod install
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x00000001022ec000

어쩌다가 React Native를 하게 되어 ios 디렉터리에서 pod install 을 실행하였는데, 이상한 오류가 발생하였다.

실행 환경은 M1 Macbook Pro (2020), macOS Monterey 12.3.1에서 발생하였다.

해결법

아키텍쳐 관련 문제인 것으로 보이는데, homebrew 버전의 cocoapods은 해당 문제가 해결된 것으로 보인다.

# gem으로 설치한 cocoapods 삭제
sudo gem uninstall cocoapods
# homebrew에서 cocoapods 설치
brew install cocoapods

혹은 다른 해결법

예전에 M1 대응이 어려웠을 때 이용했던 방법이며, 현재는 cocoapods에서는 권장하지 않고 있다. 아키텍쳐 문제가 발생하는 경우에만 사용하자.

arch 명령어를 이용하여 x86_64 아키텍쳐로 gem을 실행한다. 따라서 로제타2가 머신에 깔려 있어야 동작한다.

softwareupdate --install-rosetta

sudo arch -x86_64 gem install ffi

다만 cocoapods에서는 해당 명령어를 이용하여 pod install을 하지 말라고 안내하고 있다.

[!] Do not use "pod install" from inside Rosetta2 (x86_64 emulation on arm64).
[!] - Emulated x86_64 is slower than native arm64
[!] - May result in mixed architectures in rubygems (eg: ffi_c.bundle files may be x86_64 with an arm64 interpreter)
[!] Run "env /usr/bin/arch -arm64 /bin/bash --login" then try again.

arch -x86_64 pod install

안내

해당 글은 '도다 Aha!'에서 이전된 글입니다. 이전 글과 달라진 부분이 있을 수 있습니다.

태그
ios
react-native
반응과 댓글 시스템은 Giscus에 의해 호스팅되며, 모든 대화는 GitHub에 저장됩니다.

출처가 명확하지 않은 내용을 신뢰하지 마세요. 글 작성자는 이로 인해 발생하는 책임을 지지 않습니다.

피드백 무엇이든 환영합니다 🤗

doda.devlicensegithubmade with ☕️