Fixing `error: unsupported option '-G' for target 'arm64-apple-ios17.0' (in target 'BoringSSL-GRPC' from project 'Pods')`
Today my Flutter app failed to compile in iOS. The error was:
error: unsupported option '-G' for target 'arm64-apple-ios17.0' (in target 'BoringSSL-GRPC' from project 'Pods')
It seems like this error started popping up a few months ago.
The issue is, all of those posts give a code snippet that one is supposed to copy/paste (example). First of all, I don't want to copy paste snippet that I don't understand. Second, there should be a better, more scalable way of doing this. I'm certainly not copy/pasting the same snippet every time a similar issue pops up, in each and every one of my apps. Because then it forces me to copy/paste them in my future apps too, without knowing what is really needed.
Some tickets like https://github.com/firebase/firebase-ios-sdk/issues/13115 might refer to other threads (https://github.com/grpc/grpc/issues/36888) and it's not obvious what the solution is. In the end, what helped me solve it was this message:
Fixed in 1.65.2 and 1.66.0-pre1 release
So my guess is GRPC is a transitive dependency. So I upgraded all my dependencies' major versions and hoped for the best:
flutter pub upgrade --major-versions --tighten
cd ios
pod update
cd ..
./deployiOS.sh
And sure enough it fixed the issue. Now onto the next compilation issue...