Skip to content

iOS Flutter Build Fails: unsupported option '-G' for target 'arm64-apple-ios10.0' #172945

@MrTolaMan

Description

@MrTolaMan

Description

I'm building a Flutter project for iOS using a MacBook with Apple Silicon (M4 chip) and CocoaPods. I’ve run into the following issue when trying to build for device:


❌ Build Error:

Error (Xcode): unsupported option '-G' for target 'arm64-apple-ios10.0'
Encountered error while building for device.


Environment

- **Flutter version:** 3.22.1 (stable)
- **CocoaPods version:** 1.14.3 (installed via native ARM64 terminal)
- **Mac architecture:** Apple Silicon (M4 chip)
- **Flutter project name:** `psalm_91`
- **iOS minimum version:** 13.0
- **Command used:**
  ```bash
  flutter build ios --no-codesign

PODFILE CONFIG

platform :ios, '13.0'

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
  'Debug' => :debug,
  'Profile' => :release,
  'Release' => :release,
}

def flutter_root
  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
  unless File.exist?(generated_xcode_build_settings_path)
    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
  end

  File.foreach(generated_xcode_build_settings_path) do |line|
    matches = line.match(/FLUTTER_ROOT\=(.*)/)
    return matches[1].strip if matches
  end
  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
  use_frameworks!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  target 'RunnerTests' do
    inherit! :search_paths
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

Repro Steps

flutter create psalm_91
cd psalm_91

Insert Podfile shown above

flutter clean
flutter pub get
cd ios
rm -rf Pods Podfile.lock
pod install
cd ..
flutter build ios --no-codesign

What I’ve Tried

Installing CocoaPods natively (arch shows arm64)
Removing use_modular_headers!
Replacing Podfile with known-working version
Rebuilding Pods and cleaning Xcode cache
Recreating entire iOS folder with flutter create .
❓Request for Help
What could be injecting the invalid -G flag?
Is this coming from a dependency or toolchain mismatch?
Any ideas how to trace or disable the use of -G?

Thanks so much for your help 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: firebaseFirebase pluginsplatform-iosiOS applications specificallyt: xcode"xcodebuild" on iOS and general Xcode project managementteam-iosOwned by iOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions