Skip to content

BoringSSL-GRPC Unsupported Option in Xcode 16

Problem Statement

After updating to Xcode 16, building an iOS application that includes the BoringSSL-GRPC pod may fail with the error:

BoringSSL-GRPC unsupported option '-G' for target 'arm64-apple-ios15.0'

This occurs because Xcode 16 no longer supports the -GCC_WARN_INHIBIT_ALL_WARNINGS compiler flag (represented as -G) for certain build targets. This issue typically arises in Flutter projects when Firebase dependencies are involved, or when using gRPC-specific libraries. Common troubleshooting steps like updating pods (pod update) or adjusting deployment targets often fail to resolve the issue.


Here are the two most effective solutions, prioritized based on effectiveness:

1. Modify Podfile to Remove Problem Flag (Preferred)

Add this post_install script to your ios/Podfile to remove the unsupported flag from the BoringSSL-GRPC target:

ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
    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
          flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
          file.settings['COMPILER_FLAGS'] = flags.join(' ')
        end
      end
    end
  end
end

Follow these steps:

  1. Add the script above to the end of your Podfile
  2. Execute these terminal commands:
bash
cd ios
pod cache clean --all
rm -rf Pods Podfile.lock
pod install --repo-update
cd ..
flutter clean
  1. Rebuild your project.

2. Update Firebase Plugins

If you use Firebase, update all related dependencies to their latest versions (as of Nov 2024 or newer):

  1. Update pubspec.yaml:
yaml
dependencies:
  firebase_core: ^3.6.0
  firebase_auth: ^5.3.1
  cloud_firestore: ^5.4.4
  firebase_messaging: ^15.1.3
  firebase_storage: ^12.3.3
  cloud_functions: ^5.1.3
  1. Run:
bash
flutter clean
flutter pub get

Additional Configuration Options

If the primary solutions don't work, combine the Podfile modification with these settings:

Adjust deployment targets in ios/Podfile:

ruby
platform :ios, '13.0'  # Minimum iOS 13.0

Exclude architectures for simulators (in ios/Podfile):

ruby
post_install do |installer|
  # ... (Previous BoringSSL fix)
  
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end

Enable non-modular includes (Xcode Build Setting):

  1. Open your project in Xcode
  2. Select the Runner target
  3. Under Build Settings, search for ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES
  4. Set it to YES

Key Notes

  1. Flutter Cleanup: Always run flutter clean after modifying platform configurations.
  2. Pod Cache: Clear pod caches with pod cache clean --all if Xcode behaves unexpectedly.
  3. Firebase Versioning: Ensure all Firebase plugins use compatible versions.

Why This Works: The Podfile script surgically removes the problematic -GCC_WARN_INHIBIT_ALL_WARNINGS flag specific to the BoringSSL-GRPC target. The flag became incompatible with Xcode 16's updated toolchain but is unnecessary for functionality. The other configuration tweaks (architecture exclusion, deployment target) handle secondary environment inconsistencies.