I’m encountering a difficulty when attempting to run my Flutter software on the iOS simulator (iPhone 15 Professional Max, iOS 17.5). The construct course of fails with the next error:
Error (Xcode): unsupported possibility ‘-G’ for goal ‘x86_64-apple-ios15.0-simulator’
Couldn’t construct the appliance for the simulator.
Error launching software on iPhone 15 Professional Max.
I’m utilizing Flutter 3.29.2 (steady channel) and Xcode model 16.3. I’m additionally utilizing Firebase SDK model $FirebaseSDKVersion = ‘10.25.0’.
Right here is the total content material of my ios/Podfile:
Ruby
platform :ios, '15.0'
$FirebaseSDKVersion = '10.25.0'
# Configuration
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
use_frameworks! :linkage => :static
use_modular_headers!
mission 'Runner', {
'Debug' => :debug,
'Profile' => :launch,
'Launch' => :launch,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.be a part of('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
except File.exist?(generated_xcode_build_settings_path)
increase "#{generated_xcode_build_settings_path} should exist. When you're working pod set up manually, make sure that flutter pub get is executed first"
finish
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT=(.*)/)
return matches[1].strip}. Attempt deleting Generated.xcconfig, then run flutter pub get"
finish
require File.expand_path(File.be a part of('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
goal 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
# Firebase pods
pod 'Firebase/Core', :modular_headers => true
pod 'Firebase/Database', :modular_headers => true
pod 'Firebase/Auth', :modular_headers => true
pod 'Firebase/Messaging', :modular_headers => true
pod 'FirebaseFirestore', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
finish
post_install do |installer|
installer.pods_project.targets.every do |goal|
flutter_additional_ios_build_settings(goal)
goal.build_configurations.every do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.0'
config.build_settings['ENABLE_BITCODE'] = 'NO'
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
config.build_settings['ENABLE_MODULE_VERIFIER'] = 'NO'
config.build_settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'NO'
# Try and take away the problematic flag
if config.build_settings['OTHER_CFLAGS']
config.build_settings['OTHER_CFLAGS'].gsub!(/-G/, '')
finish
if config.build_settings['OTHER_LDFLAGS']
config.build_settings['OTHER_LDFLAGS'].gsub!(/-G/, '')
finish
# Cleanup xcconfig information for Xcode 16.3 (try)
if config.base_configuration_reference
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.learn(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
xcconfig_mod = xcconfig_mod.gsub(/-Gs*/, '') # Take away -G with trailing whitespace
xcconfig_mod = xcconfig_mod.gsub(/s+-G($|s+)/, ' ') # Take away -G with main whitespace
File.open(xcconfig_path, "w") file
finish
# Examine and cleanup different construct settings (try)
['OTHER_CFLAGS', 'OTHER_CPLUSPLUSFLAGS', 'OTHER_LDFLAGS', 'OTHER_SWIFT_FLAGS'].every do |setting|
if config.build_settings[setting]
if config.build_settings[setting].is_a?(String)
config.build_settings[setting] = config.build_settings[setting].gsub(/-Gs*/, '')
elsif config.build_settings[setting].is_a?(Array)
config.build_settings[setting] = config.build_settings[setting].reject flag == '-G'
finish
finish
finish
finish
finish
installer.pods_project.build_configurations.every do |config|
config.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
finish
finish
I’ve tried a number of steps together with deleting Pods, Podfile.lock, DerivedData, working flutter clear, flutter pub get, and numerous pod set up variations. I additionally obtained a warning from CocoaPods concerning the bottom configuration:
[!] CocoaPods didn’t set the bottom configuration of your mission as a result of your mission already has a customized config set. To ensure that CocoaPods integration to work in any respect, please both set the bottom configurations of the goal Runner
to Goal Help Information/Pods-Runner/Pods-Runner.profile.xcconfig
or embrace the Goal Help Information/Pods-Runner/Pods-Runner.profile.xcconfig
in your construct configuration (Flutter/Launch.xcconfig
).
Curiously, I’ve tried so as to add logic within the post_install hook of the Podfile to explicitly take away the -G flag from numerous construct settings and even tried to change the xcconfig information straight, however the identical error persists.
Does anybody have perception into why this -G flag may nonetheless be inflicting points regardless of my makes an attempt to take away it within the Podfile? Are there different configurations in Xcode or Flutter that is perhaps introducing this flag? How can I resolve the “unsupported possibility ‘-G'” error on Xcode 16.3 for the iOS simulator on this Flutter mission?
Thanks in your help.