Repository navigation
readlink -f added in XCode < 14.3 causes archiving error #125286
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
Unfortunately the fix with readlink -f (#123890) doesn't work for older Xcode/MacOS reporting error: readlink: illegal option -- f when trying to flutter build ipa. My env is:
[✓] Flutter (Channel stable, 3.7.12, on macOS 12.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
It started to happen when I did flutter upgrade to the latest (from 3.7.7 or so).
To reproduce:
- Test on the platform as above
- Call
flutter clean - Call
flutter build ipaor precede it withflutter pub get(doesn't matter in fact) - After some time you get
Encountered error while archiving for device.and a few rows above there's error message:
mkdir -p
/Users/rocket/Library/Developer/Xcode/DerivedData/Runner-bvkptabgpblonedyoijtfiqcpvjk/Build/Intermediates.noindex/A
rchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Runner.app/Frameworks
Symlinked...
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Command PhaseScriptExecution failed with a nonzero exit code
Expected results
No errors when building archives. No -f flag added on XCode version < 14.3
Actual results
Building archive is broken with error message Encountered error while archiving for device. caused by the -f flag.
Code sample
Code sample
[Paste your code here]Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[...]
mkdir -p
/Users/rocket/Library/Developer/Xcode/DerivedData/Runner-bvkptabgpblonedyoijtfiqcpvjk/Build/Intermediates.noindex/A
rchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Runner.app/Frameworks
Symlinked...
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Planning
note: Build preparation complete
note: Building targets in dependency order
Result bundle written to path:
/var/folders/vr/480fjlkx2p35rdk07lgmc4z80000gn/T/flutter_tools.PAAjsj/flutter_ios_build_temp_dirsR80Xg/temporary_x
cresult_bundle
Encountered error while archiving for device.Flutter Doctor output
Doctor output
I don't have Android and Chrome installed on this machine so not included in the doctor log.
[✓] Flutter (Channel stable, 3.7.12, on macOS 12.0 21A5248p darwin-x64, locale en-PL)
• Flutter version 3.7.12 on channel stable at /Users/rocket/Desktop/flutter/SDK/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4d9e56e694 (3 days ago), 2023-04-17 21:47:46 -0400
• Engine revision 1a65d409c7
• Dart version 2.19.6
• DevTools version 2.20.1
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13F100
• CocoaPods version 1.12.1
[✓] VS Code (version 1.76.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.54.0
[✓] Connected device (2 available)
• iPhone 12 (mobile) • E8A448FD-2C4D-4A3E-BBFE-0A0D1B38FAB6 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 12.0 21A5248p
darwin-x64
[✓] HTTP Host Availability
• All required HTTP hosts are available
Activity
[-]readlink -f added in XCode < 14.3[/-][+]readlink -f added in XCode < 14.3 causes archiving error[/+]danagbemava-nc commentedon Apr 21, 2023
Hi @rafaellop, please provide the full verbose output of
flutter build ipa -v. The output may be huge, so kindly put it into a .txt/.log file or upload it to a service like pastebin so that we can trace the logs.Thank
rafaellop commentedon Apr 21, 2023
Here's the log from the
flutter --verbose build ipa(I did it earlier)https://www.dropbox.com/s/071sivciqffzhgd/log.txt?dl=0
danagbemava-nc commentedon Apr 21, 2023
Thanks for the logs.
Can you also share your
podfile,podfile.lock&pubspec.yamlfiles?Thank you
jmagman commentedon Apr 21, 2023
This isn't coming from Flutter, which explicitly doesn't add the flag unless you're running >= Xcode 14.3
flutter/packages/flutter_tools/lib/src/migrations/cocoapods_script_symlink.dart
Lines 36 to 40 in 5d3c1ca
This is coming from CocoaPods:
https://github.com/CocoaPods/CocoaPods/releases/tag/1.12.1
Essentially CocoaPods 1.12.1 isn't compatible with Xcode 13.x if that doesn't understand the
-fflag.jmagman commentedon Apr 21, 2023
@rafaellop I strongly suggest filing an issue with CocoaPods with reproduction steps.
The workaround from Flutter would be to figure out which Xcode version understands this flag and bump the minimum required to that.
9 remaining items
rafaellop commentedon Apr 24, 2023
So I did a test on a clean project in the same environment:
flutter create testgoogle_fonts: ^4.0.3to thepubspec.yamlflutter build ipaopen ios/Runner.xcworkspaceFinally checked in the XCode the
Project Navigator -> Pods -> Targets Support Files -> Pods Runner -> Pods-Runner-frameworksfile and it now containsreadlink -fin the row 44. I suppose the-fshouldn't be there.I also did another test and instead of the
google_fontspackage I added some random package (url_launcher) to thepubspec.yamland the effect is exactly the same. Afterflutter build ipathe-fflag appears.flutter pub getbeforeflutter build ipahas no effect on the flag appearance (the Pods section of the project is not yet created in the XCode).SmallYuuu commentedon Apr 25, 2023
I have same question😢.
MacOS big sur 11.7.6 with xcode 13.2.1.
mkdir -p /Users/Apple/Library/Developer/Xcode/DerivedData/Runner-cvmzclsfhrthrpcxtfbbfpvtascf/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/Runner.app/Frameworks
Symlinked...
readlink: illegal option -- f
usage: readlink [-n] [file ...]
Command PhaseScriptExecution failed with a nonzero exit code
SmallYuuu commentedon Apr 25, 2023
jmagman commentedon Apr 25, 2023
The
-fis coming from CocoaPods, not Flutter. @rafaellop did you file an issue with them? I don't see one.flutter create testgoogle_fonts: ^4.0.3to thepubspec.yamlflutter build ipa. I ranflutter build ipa --export-method development(because I don't have the bundle ID set up for the App Store) and it archived correctly.I'm not sure what else we could do here other than bump the minimum Xcode version to 14.
jmagman commentedon Apr 27, 2023
I am going to bump the Flutter-enforced minimum version to Xcode 14. If you're seeing this:
Ideally they would add a workaround to this on their side but I don't see a single issue actually reporting it, so they may not even know.
Increase Xcode minimum version to 14 (#125639)
github-actions commentedon May 12, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.