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

[iOS] Fix for CocoaPods Boost Installation Error in React Native 0.72.4 #2606

Open
ali-alakbar opened this issue Feb 20, 2025 · 2 comments
Open

Comments

@ali-alakbar
Copy link

ali-alakbar commented Feb 20, 2025

I've encountered issues when installing Boost in a React Native iOS project. Below is a detailed solution for disabling Flipper (debugging tool) and Hermes (JavaScript engine) to resolve the installation problems.

[!] Error installing boost
[!] /usr/bin/curl -f -L -o /var/folders/.../boost_1_76_0.tar.bz2 https://archives.boost.io/release/1.76.0/source/boost_1_76_0.tar.bz2


curl: (22) The requested URL returned error: 404
[!] Download failed with error: SSL connect error

[!] Boost archive checksum mismatch:
Expected: xxxxxba6e982c4450f33bf32a2a83292aba937b827a5623a14636ea583318c41
Got:      xxxxx6e982c4450f27bf32a2a83292aba455b827a8883a14636ea583318c22

OR only crashes with:

Expected: xxxxxxba6e982c4450f33bf32a2a83292aba035b827a5623a14636ea583318c41
Got:     xxxxxxe982c4450f27bf32a2a83292aba568b833a5623a14636ea583318c22

This error occurs because

The default boost.podspec in React Native points to an outdated or incorrect Boost archive URL
The checksum verification fails due to the failed download
The combination of Flipper and Hermes configurations can sometimes interfere with the proper resolution of CocoaPods dependencies

This issue can be resolved by properly configuring the project to disable Flipper (debugging tool) and Hermes (JavaScript engine), along with correct setup of the Boost podspec with an updated, verified source URL and checksum.

Environment required:

React Native: 0.72.4
Ruby: 3.3.3
CocoaPods: 1.14.3
iOS target: 17.0

Steps to Resolve:

  1. Verify Ruby Version

Ensure that you have the correct Ruby version installed:

rbenv install 3.3.3  # Install if needed
rbenv global 3.3.3
ruby -v  # Verify version
  1. Clean Project

Remove all existing dependencies and caches:

# Remove existing dependencies
rm -rf node_modules
rm -rf yarn.lock
rm -rf ios/Pods
rm -rf ios/Podfile.lock
  1. Reinstall Dependencies

Reinstall dependencies for the project:

yarn install
cd ios
pod cache clean --all
  1. Configure Podfile
    Update your ios/Podfile as follows to disable Hermes and Flipper:
# ios/Podfile
platform :ios, '17.0'

# Add Boost configuration
pod 'boost', :podspec => '../node_modules/react-native/third-party-podspecs/boost.podspec'

target 'project_name' do
  config = use_native_modules!
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    :hermes_enabled => false,  # Disable Hermes
    :fabric_enabled => flags[:fabric_enabled],
    :flipper_configuration => FlipperConfiguration.disabled,  # Disable Flipper
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
end
  1. Setup Boost

Ensure that the Boost podspec directory exists and create a custom boost.podspec file:

# Create Boost podspec directory if it does not exist
mkdir -p node_modules/react-native/third-party-podspecs/
Create the boost.podspec file with the correct content:

cat > node_modules/react-native/third-party-podspecs/boost.podspec << 'EOL'
Pod::Spec.new do |spec|
  spec.name = 'boost'
  spec.version = '1.76.0'
  spec.license = { :type => 'Boost Software License', :file => "LICENSE_1_0.txt" }
  spec.homepage = 'http://www.boost.org'
  spec.summary = 'Boost provides free peer-reviewed portable C++ source libraries.'
  spec.authors = 'Rene Rivera'
  spec.source = {
    :http => 'https://archives.boost.io/release/1.76.0/source/boost_1_76_0.tar.bz2',
    :sha256 => 'xxxxx6e982c4450f27bf32a2a83292aba455b827a8883a14636ea583318c22'
  }
  spec.platforms = { :ios => '11.0' }
  spec.requires_arc = false
  spec.module_name = 'boost'
  spec.header_dir = 'boost'
  spec.preserve_path = 'boost'
end
EOL
  1. Install Pods

Finally, install the necessary CocoaPods:

pod install

@ali-alakbar
Copy link
Author

Note: The iOS build process can take quite a while, especially on the first build or after cleaning the project. This is normal because it needs to:

  1. Build all React Native dependencies
  2. Compile all native modules
  3. Link all the libraries you're using (as shown in the dependency graph)

@thymikee
Copy link
Member

Hey! Thanks for reporting, but Is this related to this CLI? The RN build system is living under https://github.com/facebook/react-native repository

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

No branches or pull requests

2 participants