71

I have flutter project, I'm trying to run the iOS version but I get error after I update flutter and Xcode to the latest version, I use firebase core plugin

error:

Could not build the precompiled application for the device. Error (Xcode): File not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation) 

Podfile:

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

I also tried to all installed pods by:

pod deintegrate rm Podfile.lock rm -rf Pods 

and then update the repositories and install the pods and I still get the same error, should I reninstall xcode?

Flutter packages:

firebase_core: ^2.8.0 firebase_crashlytics: ^3.0.17 firebase_analytics: ^10.1.6 firebase_messaging: ^14.3.0 

Any workaround for this? and thank you for your time

6

20 Answers 20

58
post_install do |installer| installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end 

Try updating your ios/Podfile. Change 13.0 with the version you have at the top of the file.

Sign up to request clarification or add additional context in comments.

6 Comments

I will try, but can you please explain what's happening here in details? Thank you for your time
it solves compile issue (we using 11.0 as it's our minimum requirement) , build but then fails on archive with ios/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/openssl_grpc.f ramework" failed: No such file or directory (2)
Why this wax not issue on Xcode 14.3?
I tried this and it works, but I'm not sure if this is a good solution, I'm not a native ios developer, and I'm only familiar with flutter and native android, so can you explain to us what is going on? what is the problem, why is it happening, and how did you solve it? thank you very much for your time
Change 13.0 with the version you have at the top of the file. For instance, for me it was 13.7.
|
29

New answer (Edit 4)

if you upgrade your Flutter and cocoa pods and Flutter plugins and still have this issue, A really simple and efficient solution is to edit your Podfile

 platform :ios, '14.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.targets.each do |target| # flutter_additional_ios_build_settings(target) # end #end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']) < Gem::Version.new('13.0') config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end flutter_additional_ios_build_settings(target) end end 

The changes that I made, is to define the platform ios version as a minimum of 14, and make sure all the pods have at least 13 minimum version, otherwise ignore it, the changes are to the second line and the post_install at the very end

Old answer (Edit 1, 2 and 3)

I fixed the issue, even though I'm not sure if that is a good solution, run the following:

flutter clean flutter pub get cd ios/ pod deintegrate pod install pod repo update pod install (again) 

Just open the ios project inside the flutter project in Xcode, go to Pods in the folders (files) tab, go to the targets, go to the targets (it pod I guess, one dependency) that causes the issue, in my case FMDB and App auth, upgrade the minimum deployments for both from the current version (in my case 9.0) to 13.0 and try run the app again by build it and run it in Xcode or using flutter run with the selected ios device, and the issue should be gone

however sometimes when you clean the project in flutter (using flutter clean), it will reset those changes, or when you delete the pods and deintegrate Cocapods and re-install the app, all the changes will be reverted back to the default, it not really an efficient solution, but at least you can run the app

and if the issue is still exists, update the minimum deployment for the pods target again and run the app using Xcode, if you still have the issue, try out the other answers or you can try update cocapods by

sudo gem install cocoapods 

if your mac machine is apple silicon (m1, m2), you also need run

sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc 

The official documentation said that

Edit: This solution idea come to me, all thanks to @Siyu

If you are from the future, you might want to try to upgrade the packages and cocapods, flutter etc...

Edit 2:

Try updating Flutter since the issue should be fixed in 3.7.11

flutter upgrade 

Edit 3:

The issue comes back again in the flutter 3.10 with some packages, so please use the way I used or try one of the answers and try to understand it, thank you for your time, Good luck

2 Comments

This Xcode 14.3 behavior changes was worked around in Flutter 3.7.11, not 3.7.10 github.com/flutter/flutter/issues/124340.
Thanks for this - I just want to add that I did a flutter upgrade then an arch -x86_64 pod install (on M1) and that's all that was needed as of April 17 2023
20

Update: The Issue is resolved in later Flutter versions run

flutter upgrade and re-initializing the dependencies

flutter clean flutter pub get cd ios/ pod deintegrate pod install pod repo update pod install 

if it's not solve the error follow the steps that mentioned bellow

Make sure you have update the pod files after that follow the steps mentioned below:

Step 1

Track the issue cased by library here in my case I got an error for FMDB file enter image description here

Step 2

Change the iOS version on effected pod with dropdown menu (small blue arrow) enter image description here

Step 3

Change Distribution setting on Target Pod enter image description here

Rebuild your app again on Xcode. and repeat the process until you solve all library issues

4 Comments

This change will work temporarily, but will be overwritten the next time pod install is called by the Flutter tooling (if you run flutter clean, add a new plugin to your pubspec, etc). Instead of manually updating, run flutter upgrade to get the Xcode 14.3 behavior change workaround in Flutter 3.7.11 github.com/flutter/flutter/issues/124340.
I have a problem in 3.10.0 and this works
Didn't work for me in Flutter 3.10.0 but It seems that issue was fixed in Flutter 3.10.1, at least for me! github.com/flutter/flutter/issues/124529
yeah I've mentioned that at the top of the answer it's resolve in newer versions
7

Facing this issue as well and went down the same path.

  1. Upgrading the deployment target to 13.0 unfortunately only solves the issue for the debug version of the app. Then, you will at least be able to run it in the simulator again.

  2. Archiving the app (e.g. build ipa to submit to store) will still fail with Xcode 14.3 for now due CocoaPods (Upgrade from xCode 14.2 to 14.3 PhaseScriptExecution failed with a nonzero exit code). Unfortunately, the (only?) solution at the moment seems to be downgrading to 14.2 while waiting for a fix from the CocoaPods side (https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1481244508)

Update The issue seems to have been found and fixed (https://github.com/CocoaPods/CocoaPods/pull/11828), but is not yet merged - Hopefully this will happen soon. In the meantime, replacing source="$(readlink "${source}")" with source="$(readlink -f "${source}")" in the ...framework.sh files seems to help.

4 Comments

I updated my testing iPhone to 16.4 and it's not compatible with Xcode 14.2
hello, could you tell please in more detail what exactly it means replacing source="$(readlink "${source}")" with source="$(readlink -f "${source}")" where to change it and how ? and how can it be done?
@songhee24 in your project go to Pods -> Targets Support Files -> Pods-YourApp -> Pods-YourApp-frameworks in that file search and replace like OP says
Issues archiving the app are unrelated to the original libarclite_iphoneos (which should be fixed with 3.7.11). This was due to an Xcode 14.3 behavior change that broke a CocoaPods script github.com/CocoaPods/CocoaPods/issues/11808. There is a workaround in Flutter tracked in github.com/flutter/flutter/issues/123890 and available in Flutter 3.7.10.
7
cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ sudo mkdir arc cd arc sudo git clone https://github.com/kamyarelyasi/Libarclite-Files.git . sudo chmod +x * 

It's worked for me.

Comments

6

The originally reported missing libarclite_iphoneos.a compilation failure is caused when when Flutter plugins have a dependency (a CocoaPods pod) with a minimum iOS version < 9.0. It seems Xcode 14.3 removed a library from its toolchain required to build these lower versions. Flutter 3.7.11 has a workaround for both iOS and macOS. More details in https://github.com/flutter/flutter/issues/124340.

The other (unrelated) issue being discussed in these answers is the failure to archive an iOS or macOS app. This was due to a different Xcode 14.3 behavior change that broke a CocoaPods script https://github.com/CocoaPods/CocoaPods/issues/11808. There is a workaround in Flutter tracked in https://github.com/flutter/flutter/issues/123890 and available in Flutter 3.7.10.

If you are seeing either issue, please run flutter upgrade to get the latest version of Flutter with these fixes. If you are still seeing issues, please file a new GitHub issue and myself or another Flutter maintainer will take a look.

Comments

4

As I've seen the problem was coming from Flutter's plugins deployment target that is still at 8.0, which is solved by manually updating it to a higher version with Xcode, in case you want to make it automatically, you can put these codes inside ios/Podfile at post_install

 installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] == '8.0' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' end end end end 

so it will look like this

post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end # Here is the code I provide above ================== installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] == '8.0' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' end end end end #Here is the end =================================== end 

after that run pod install in the ios folder...

What it does do? The code will override every pod's deployment target that is still at 8.0 into 11.0, by this logic you'll not bother any plugins that maybe requires a specific deployment target (which is higher than 8.0 for sure)

2 Comments

I am the Flutter maintainer who fixed this issue. Please do not edit your Podfile as described in this answer. Instead, please run flutter upgrade to get the workaround to the Xcode 14.3 behavior change in Flutter 3.7.11 github.com/flutter/flutter/issues/124340.
Hey, I'm agree, BUT I have updated to flutter 3.7.12 and the issue does not get solved for me.
2

Check the iOS Deployment Target for the installed pod, it should be minimum iOS 11.0.

Pod (select a pod) -> Build Setting -> Deployment -> iOS Deployment target (minimum 11.0) enter image description here

Comments

1

Providing my share of thoughts.

I'm building for MacOS and the file Xcode was complaining about is libarclite_macosx. So similar scenario.

The solution is to change the deployment target to RECOMMENDED_MACOSX_DEPLOYMENT_TARGET, which is currently equivalent to MacOS 10.13 for Xcode 14.3.

This essentially removes the dependency of that unnecessary file because

the app’s deployment target is modern enough that it can rely on ARC being built in to the system. Indeed, that’s always the case with Xcode 14, where it’s minimum supported deployment target is iOS 11

Reference: https://developer.apple.com/forums/thread/725300

For your case, I believe that means update the deployment target within Xcode and podfile.

4 Comments

There is no RECOMMENDED_MACOSX_DEPLOYMENT_TARGET in ios project, only on mac os project, so do you suggest to manually upgrade it? like 13 or 14? because I did for the pod file and project and runner target to 14 and I still get the exists same error
@AhmedHnewa For iOS you'll need its iOS counterpart, RECOMMENDED_IOS_DEPLOYMENT_TARGET or manually set it to its equivalent value. Check your pod file as well as the project configuration in Xcode
@Siyu can you give more info on what you did to get this working for macOS, I am running into this issue currently and this is the only reference to it I can find.
@JonasSmith Change the deployment target to RECOMMENDED_MACOSX_DEPLOYMENT_TARGET in the project settings for all your build targets. If you use a package manager, you may need to change the corresponding settings there as well.
1

If you've updated to xcode 14.3 and above. Do the following:

Open file project.pbxproj (ios/Pods/Pods.xcodeproj/project.pbxproj) and make sure "IPHONEOS_DEPLOYMENT_TARGET" is set to 11.0 or greater.

To make changes permanent add target deployment in the podfile as follows:-

platform :ios, '12.0' # set IPHONEOS_DEPLOYMENT_TARGET for the pods project post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' end end end 

Then run "flutter pub get".

You should be good to go.

Inspired by @dawnsong

1 Comment

Hi, can you please explain what does this change do in term for any flutter developer can understand? why the issue happen anyway, we are here to understand what are we doing and not just solve issues and get it work, thank you for your time.
1

I just had the same issue when updated my Xcode to 14.3

I have found a quick workaround by updating iOS Deployment Target of my installed pods. I have set iOS Deployment Target to 11 for the pods that are targeted below 11. This works like a charm but if you reinstall your pods you will need to do this change again as pods will be installed by their default deployment targets.

Then I have placed install script in to my Podfile as below. Then I run pod install command on command line to reflect the changes. Note I set the deployment target 11 first but I got error because some of my pods needs at least 13, so I have changed it to 13 because It will affect all of your pods.

target 'YourApp' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! # Pods for YourApp pod ... pod ... post_install do |installer| installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end end end 

Comments

1

I'm able to build my project into emulator as well as my own device but unable to archive it to push to AppStore. Knowing that this is a bug in Xcode 14.3, and none of the change minimum requirement or other Podfile modification method, I solved it by using 14.2 and ignore 14.3 for the time being

Having my Xcode installed from AppStore, the slowest method of all, I used a Xcode version manager that I found from here https://betterprogramming.pub/easily-swith-between-xcode-versions-b36f9f685979

Long story short here are some snippets of the steps I took

Step 1: Install Xcode manager and install Xcode 14.2 (It'll ask for your AppleID credentials)

gem install xcode-install xcversion install 14.2 xcversion select 14.2 

Step 2: Open Xcode-14.2.app from your MacOS Applications folder

Step 3: If your project works in Xcode 14.2 before then hopefully this will fix it

Comments

1

I had this problem with many of my libraries and I found the solution by changing the minimum deployments of the libraries. I got rid of the build error by updating the minimum deployments from 8.0 to 11.0.

Comments

1

For cordova projects add following line in config.xml under platform ios

<platform name="ios"> <preference name="deployment-target" value="11.0" /> </platform> 

Comments

1

You can follow the below steps to fix this:

  1. Make sure you have flutter version 3.7.10 or above installed on your machine.
  2. For most people only doing the above step and then rebuilding after deleting the podfile, podfile.lock, pods directory, and pubspec.lock file should fix it.
  3. If it still didn't fixed for you, it could be the reason that you may have some packages with iOS deployment target set to 10 or below. To fix this, go to the bottom of the podfile and replace the below code
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end 

with code

post_install do |installer| installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end end installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) end end 

and rebuild. This should fix it for sure.

2 Comments

Or you can upgrade flutter for the latest version and it should work for most of the cases
Yeah, that's what I had said in point #2
1
post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' end end end 

Just update the development target for all integrated pods > run pod install > rerun the project

Comments

0

I fixed this by adding the following to the post_install section of my pod file (replace the deployment target with your required):

installer.generated_projects.each do |project| project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0' end end end # Check out: https://github.com/flutter/flutter/issues/123852 # Workaround for Xcode 14.3: system('sed -i \'\' \'44s/readlink/readlink -f/\' \'Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\'') ... 

3 Comments

Thank you but can you explain what you did with this change?
No problem, look for this line in your podfile post_install do |installer| . Under that add what I put above. And replace IPHONEOS_DEPLOYMENT_TARGET with the required version. e.g. 13.0
You're ensuring all your pods are set to 14.0 and then adding in the recommended workaround as CocoaPods has a bug at the moment.
0

This works: https://dev.to/curtlycritchlow/how-to-fix-missing-file-libarcliteiphonesosaxcode-143-4hki

which will need to be done each time after you run pod install

or you can simply add this at the end of Podfile

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" config.build_settings['ENABLE_BITCODE'] = 'NO' end end end 

Comments

0

I found this solution on Apple Developer Forum, it seems to be related to the new XCode version (14.3) that use the relative path for framework's Pods.

(in my case APPNAME is RUNNER)

Find the Pods-APPNAME-frameworks.sh file in ios/Pods/Target Support Files/Pods-APPNAME/Pods-APPNAME-frameworks.sh:

Replace:

if [ -L "${source}" ]; then echo "Symlinked..." source="$(readlink "${source}")" fi 

with:

 if [ -L "${source}" ]; then echo "Symlinked..." source="$(readlink -f "${source}")" fi 

Note that -f was added.

Comments

0

following solution is worked for me. i have m2 chip MacBook I changed ios version in my podfile

platform :ios, '14.0', 

then next change is i add following code to my pods file

post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if Gem::Version.new(config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']) < Gem::Version.new('13.0') config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' end end flutter_additional_ios_build_settings(target) end end 

1 Comment

Not sure why this question marked as useful but who ever give his opinion is probably bored with is life

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.