React Native Xcode Boost Error
이번에 옛버전 프로젝트를 작업 하다 처음 접해보이는 오류를 접하게 되었습니다.
[!] Invalid boost.podspec file: undefined local variable or method min_supported_versions' for module Pod.
해당 이슈는 react native 0.72.6 버전으로 진행을 하게 되었으며 알아보니 version이 낮아 생긴 이슈라는 정보를 알게 되었습니다. 지금부터 해당 이슈를 해결하기 위해 시도 했던 방법들에 대해 이야기를 해볼려고 합니다.
우선, 처음에 언급한 것 처럼 버전 이슈로 발생하는 경우가 많으며, react native 버전과 CocoaPods 버전이 호환이 되지 않으면 해당 현상이 일어난다고 합니다.
1. 문제 발생 원인
Xcode에서 boost 라이브러리를 사용하려 할 때 boost.podspec의 소스 URL이 잘못되어 있어 다운로드에 실패하는 경우가 발생합니다. 특히, boost.podspec 파일 내에서 boost 라이브러리를 가져오는 URL이 다음과 같이 설정되어 있습니다.
spec.source = { :http => 'https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2',
:sha256 => '6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e' }
이 URL이 더 이상 유효하지 않아 boost 다운로드가 실패하고 Xcode 빌드가 중단되며, 이러한 문제는 boost 저장소의 변경이나 이전으로 인해 발생할 수 있습니다.
2. 해결 방법: patch-package를 이용한 패치 적용
이 문제를 해결하기 위해 boost.podspec을 수정하고, patch-package를 사용하여 변경 사항을 유지하는 방법이 존재합니다
- patch-package를 설치
npm install --save-dev patch-package postinstall-postinstall
- boost.podspec 파일을 열고 다음과 같이 spec.source 값을 변경
(수정전)
spec.source = { :http => 'https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2',
:sha256 => '6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e' }
(수정후)
spec.source = { :http => 'https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.bz2',
:sha256 => '6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e' }
이렇게 변경하면 boost 라이브러리를 올바른 URL에서 가져올 수 있습니다.
- 변경 사항을 패치 파일로 저장
npx patch-package react-native
위 명령어를 실행하면 프로젝트 root 디렉토리에 patches/ 폴더가 생성되며, boost.podspec 변경 사항이 반영된 패치 파일이 저장됩니다.
- 패치 자동 적용 설정
이제 package.json의 scripts 섹션에 postinstall 스크립트를 추가하여, npm install 실행 시 패치가 자동으로 적용되도록 설정을 합니다.
"scripts": {
"postinstall": "patch-package"
}
해당 자료는 Boost 공식 라이브러리 사이트 이며, 현재 사용 중인 프로젝트 버전에 호환되는 버전을 확인하여 사용을 해주셔야 합니다.
Boost C++ Libraries
Much work goes into the documentation for the Boost libraries and tools. The documentation included in the library and tool release is also available here: Additional information about the testing and release practices, infrastructure and in progress devel
www.boost.org
해당 이슈를 해결하고자 참고 하였던 GitHub에 올라온 내용입니다. 참고 하실 분들은 확인 해주세요.
Error installing boost Verification checksum was incorrect · Issue #843 · boostorg/boost
I'm developing a Mobile app with React Native (0.73.1) and for building the app I need to install the pods. The pods contains installing boos, see this file. I get the following error Installing bo...
github.com
GitHub - ds300/patch-package: Fix broken node modules instantly 🏃🏽♀️💨
Fix broken node modules instantly 🏃🏽♀️💨. Contribute to ds300/patch-package development by creating an account on GitHub.
github.com
결론
솔직히 말해 위 내용은 해당 이슈를 해결하고자 알아본 자료들이며, 결국 제가 선택한 방법은 매우 간단한 방법으로 마무리를 지었습니다. 해당 방법은 결국 boots 이슈 문제는 처음에 말한 것 처럼 버전 문제임으로 react native 버전을 업그레이드 하여 진행하였으며, 0.72 -> 0.73으로 0.1만 올려도 사용 중인 라이브러리 호환성 문제가 발생 할 수 있기 때문에 react native 공식 문서를 확인하여 0.72.6 -> 0.72.12로 0.72의 제일 마지막 단계로 업그레이드를 진행하여 해당 이슈를 해결 하였습니다.
어디까지나 작업자 마다 상황이 다르기 때문에 어떠한 방법이 현재 상황에 맞을지 몰라 여러가지 방법을 모색하였으며,
현재 본인에 맞는 상황에 맞춰 작업을 진행하는 것을 추천드리겠습니다.