Skip to content

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

Open
@ali-alakbar

Description

@ali-alakbar

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions