Home:ALL Converter>Not able to run flutter ios build in xcode on mac with m1 processor

Not able to run flutter ios build in xcode on mac with m1 processor

Ask Time:2021-06-27T23:52:16         Author:vipul bansal

Json Formatter

This is the error log that I am getting. This issue is occuring when I am trying to run my ios build using xcode but it doesnt cause issue on android studio.

ld: warning: ignoring file /Users/vipulhome/Library/Developer/Xcode/DerivedData/Runner-dazmieaxtygkyugrsywdqvmtzcsr/Build/Products/Debug-iphonesimulator/FMDB/FMDB.framework/FMDB, building for iOS Simulator-x86_64 but attempting to link with file built for iOS Simulator-arm64
Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FMDatabaseQueue", referenced from:
      objc-class-ref in SqflitePlugin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Following is my podfile. I ran pod install and its running but when I try to run it on the xcode it doesnt run.

 # Uncomment this line to define a global platform for your project
# platform :ios, '9.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__))
end

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

And here is flutter version

    [✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-arm, locale en-IN)
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    [✓] Xcode - develop for iOS and macOS
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 4.1)
    [✓] Connected device (2 available)

Author:vipul bansal,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/68152890/not-able-to-run-flutter-ios-build-in-xcode-on-mac-with-m1-processor
yy