我正在尝试为我的 Flutter 项目运行
pod install
,但在安装 BoringSSL-GRPC
时我一直遇到错误。这是完整的错误消息:
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
手动将boringssl存储库克隆到CocoaPods用于临时文件的目录中:
git clone https://github.com/google/boringssl.git/var/folders/_j/y2bmb3f57vv3ngw1nfzqs_zr0000gn/T/d20241010-72238-37tuvs
存储库的浅克隆:
git clone --depth 1 https://github.com/google/boringssl.git/var/folders/_j/y2bmb3f57vv3ngw1nfzqs_zr0000gn/T/d20241010-72238-37tuvs
使用以下方法增加 Git 缓冲区大小:
git config --global http.postBuffer 524288000
使用
pod install
运行 arch -x86_64
以确保与我的 Apple Silicon Mac 兼容:
arch -x86_64 pod install --repo-update
尽管如此,我还是不断遇到同样的错误。我的互联网连接很稳定,并且我已多次尝试安装此依赖项,但我不断遇到
RPC failed
问题。
有人经历过这种情况或者知道如何解决这个问题吗?我很感激任何建议!
尝试将自定义脚本添加到 Podfile 中,以删除 BoringSSL-GRPC 不需要的编译器标志。
转到 -> ios/Podfile
在 post_install 块中添加以下代码
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
然后尝试运行“pod repo update && pod install”命令。