⚒️
【Flutter】Xcode16で出たiOSビルドエラーの解決方法
Xcode 16.0にしてからFlutterのiOSビルドでエラーが出るようになりました。その解決方法の備忘録です。
出たエラー
エラー1
Running Xcode build...
Xcode build done. 16.9s
Failed to build iOS app
Error output from Xcode build:
↳
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:96ECC615-22F8-4AC5-A243-23A97150BEA6, OS:17.5, name:iPhone 15 Pro }
{ platform:iOS Simulator, id:96ECC615-22F8-4AC5-A243-23A97150BEA6, OS:17.5, name:iPhone 15 Pro }
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/qk/cdlmk8g134l9p2_9m1_wxbym0000gn/T/flutter_tools.PZX7AE/flutter_ios_build_temp_dirMrXiGG/temporary_xcresult_bundle
error: unsupported option '-G' for target 'arm64-apple-ios14.0-simulator' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios14.0-simulator' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios14.0-simulator' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios14.0-simulator' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios14.0-simulator' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios14.0-simulator' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios14.0-simulator' (in target 'BoringSSL-GRPC' from project 'Pods')
error: unsupported option '-G' for target 'arm64-apple-ios14.0-simulator' (in target 'BoringSSL-GRPC' from project 'Pods')
エラー2
Error (Xcode): unsupported option '-G' for target 'x86_64-apple-ios12.0-simulator'
解決方法
以下を全部やりました。
- Xcode Settingsで
ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
にする - 以下をpodfileに追記
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
- 以下のコマンドを打ってクリーンにする
cd ios
rm -rf Pods
rm -rf Podfile.lock
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod cache clean --all
arch -x86_64 pod install
brew install rbenv
sudo gem install cocoapods
flutter clean
flutter pub get
参考にしたリンク
Discussion
こちらも同じ現象だと思いますが、僕はこれだけでは治らなかったので、こちらの記事を書きました!