After update can no longer build to iOS Simulator (Intel Mac)
cfsbhawkins opened this issue · 4 comments
Using latest from pub.dev, I am no longer able to launch my app on Simulator. I am getting the following error, I know there was another ticket that was for M1 mac but mine is on Intel.
I do have the line in my podfile to exclude arm64 because another library needs it to run.
Flutter SDK 3.3.0
datadog_flutter_plugin-1.0.0-rc.2
import Datadog
^
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/ly/jm6ykbqn1m9dy924kw9t7p640000gq/T/flutter_tools.asSNrm/flutter_ios_build_temp_dirF39kdX/temporary_xcresult_bundle
Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code
Swift Compiler Error (Xcode): Could not find module 'Datadog' for target 'arm64-apple-ios-simulator'; found: x86_64-apple-ios-simulator, at: /Users/bhawkins/Flutter Apps/core-flutter/build/ios/Debug-dev-iphonesimulator/DatadogSDK/Datadog.framework/Modules/Datadog.swiftmodule
/Users/bhawkins/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/datadog_flutter_plugin-1.0.0-rc.2/ios/Classes/DatadogFlutterModels.swift:5:7
Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).
Hi @cfsbhawkins, thanks for reporting this!
I'm very confused why Xcode is looking for the arm64 target on an Intel Mac, but I'll look into it. I didn't update to Flutter 3.3 yesterday, and that may have something to do with it. I'll try to test with it today.
After a cursory check of Flutter 3.3.0, it appears that is not the issue (the example still builds fine).
Just to be super thorough, can you try a clean build (run flutter clean
)? If that still doesn't work, can you send me over the additional lines of your Podfile and I'll try to replicate locally.
I will have someone else on my team try my branch on their mac, but I did both flutter clean and nuked and repulled the repo from git and still cant build to iOS Simulator.
edit: someone else on my team tried to run and was unable to run ios simulator with an older build as well. Physical device debugging works just fine in both mine and his computer.
platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
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!
use_modular_headers!
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.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=1',
]
end
end
end
So I think I solved it for anyone who needs it, this fixed it in the as well as allowed mapbox to work:
config.build_settings['ARCHS[sdk=iphonesimulator]'] = uname -m
*
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['ARCHS[sdk=iphonesimulator*]'] = `uname -m`
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse]
'PERMISSION_LOCATION=1',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
## dart: PermissionGroup.photos
'PERMISSION_PHOTOS=1',
## dart: PermissionGroup.sensors
'PERMISSION_SENSORS=1',
]
end
end
end