fluttercocoapodsgrpcboringssl

CocoaPods Error Installing `BoringSSL-GRPC` during `pod install` – RPC failed, curl 92 HTTP/2 stream not closed cleanly


I’m trying to run pod install for my Flutter project, but I keep running into an error while installing BoringSSL-GRPC. Here's the full error message:

arch -x86_64 pod install --repo-update     

Updating local specs repositories
Analyzing dependencies
cloud_firestore: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '11.2.0' defined in 'firebase_core'
Downloading dependencies
Installing BoringSSL-GRPC (0.0.36)

[!] Error installing BoringSSL-GRPC
[!] /opt/homebrew/bin/git clone https://github.com/google/boringssl.git /var/folders/_j/y2bmb3f57vv3ngw1nfzqs_zr0000gn/T/d20241010-83288-6dfggb --template=

Cloning into '/var/folders/_j/y2bmb3f57vv3ngw1nfzqs_zr0000gn/T/d20241010-83288-6dfggb'...
error: RPC failed; curl 92 HTTP/2 stream 5 was not closed cleanly: CANCEL (err 8)
error: 10 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output

Manually cloning the boringssl repository into the directory that CocoaPods uses for temporary files:

git clone https://github.com/google/boringssl.git/var/folders/_j/y2bmb3f57vv3ngw1nfzqs_zr0000gn/T/d20241010-72238-37tuvs

Shallow clone of the repository:

git clone --depth 1 https://github.com/google/boringssl.git/var/folders/_j/y2bmb3f57vv3ngw1nfzqs_zr0000gn/T/d20241010-72238-37tuvs

Increasing Git buffer size using:

git config --global http.postBuffer 524288000

Running pod install with arch -x86_64 to ensure compatibility with my Apple Silicon Mac:

arch -x86_64 pod install --repo-update

Despite all of this, I keep getting the same error. My internet connection is stable, and I’ve tried multiple times to install this dependency, but I keep running into the RPC failed issue.

Has anyone experienced this or knows how to resolve this issue? I’d appreciate any suggestions!


Solution

  • Try to add custom script to your Podfile to remove unwanted compiler flags for BoringSSL-GRPC.

    Goto -> ios/Podfile

    Add the following code in post_install block

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        flutter_additional_ios_build_settings(target)
    
        # Additional logic for BoringSSL-GRPC
        if target.name == 'BoringSSL-GRPC'
          target.source_build_phase.files.each do |file|
            if file.settings && file.settings['COMPILER_FLAGS']
              flags = file.settings['COMPILER_FLAGS'].split
              # Remove the '-GCC_WARN_INHIBIT_ALL_WARNINGS' flag
              flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
              file.settings['COMPILER_FLAGS'] = flags.join(' ')
            end
          end
        end
      end
    end
    

    Then try to run "pod repo update && pod install" command.