Skip to content

readlink -f added in XCode < 14.3 causes archiving error #125286

Closed

Description

@rafaellop

Is there an existing issue for this?

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:

  1. Test on the platform as above
  2. Call flutter clean
  3. Call flutter build ipa or precede it with flutter pub get (doesn't matter in fact)
  4. 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

  1. changed the title [-]readlink -f added in XCode < 14.3[/-] [+]readlink -f added in XCode < 14.3 causes archiving error[/+] on Apr 21, 2023
  2. danagbemava-nc commented on Apr 21, 2023

    @danagbemava-nc
    Member

    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

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 21, 2023
  4. rafaellop commented on Apr 21, 2023

    @rafaellop
    Author

    Here's the log from the flutter --verbose build ipa (I did it earlier)
    https://www.dropbox.com/s/071sivciqffzhgd/log.txt?dl=0

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 21, 2023
  6. danagbemava-nc commented on Apr 21, 2023

    @danagbemava-nc
    Member

    Thanks for the logs.

    Can you also share your podfile, podfile.lock & pubspec.yaml files?

    Thank you

  7. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 21, 2023
  8. jmagman commented on Apr 21, 2023

    @jmagman
    Member

    This isn't coming from Flutter, which explicitly doesn't add the flag unless you're running >= Xcode 14.3

    // If Xcode not installed or less than 14.3 with readlink behavior change, skip this migration.
    if (version == null || version < Version(14, 3, 0)) {
    logger.printTrace('Detected Xcode version is $version, below 14.3, skipping "readlink -f" workaround.');
    return;
    }

    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 -f flag.

  9. added
    platform-iosiOS applications specifically
    toolAffects the "flutter" command-line tool. See also t: labels.
    t: xcode"xcodebuild" on iOS and general Xcode project management
    and removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    in triagePresently being triaged by the triage team
    on Apr 21, 2023
  10. jmagman commented on Apr 21, 2023

    @jmagman
    Member

    @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.

  11. 9 remaining items

  12. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Apr 24, 2023
  13. rafaellop commented on Apr 24, 2023

    @rafaellop
    Author

    So I did a test on a clean project in the same environment:

    1. flutter create test
    2. Added google_fonts: ^4.0.3 to the pubspec.yaml
    3. Called flutter build ipa
    4. Called open ios/Runner.xcworkspace

    Finally checked in the XCode the Project Navigator -> Pods -> Targets Support Files -> Pods Runner -> Pods-Runner-frameworks file and it now contains readlink -f in the row 44. I suppose the -f shouldn't be there.

    I also did another test and instead of the google_fonts package I added some random package (url_launcher) to the pubspec.yaml and the effect is exactly the same. After flutter build ipa the -f flag appears. flutter pub get before flutter build ipa has no effect on the flag appearance (the Pods section of the project is not yet created in the XCode).

  14. SmallYuuu commented on Apr 25, 2023

    @SmallYuuu

    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

  15. SmallYuuu commented on Apr 25, 2023

    @SmallYuuu
  16. jmagman commented on Apr 25, 2023

    @jmagman
    Member
    1. flutter create test
    2. Added google_fonts: ^4.0.3 to the pubspec.yaml
    3. Called flutter build ipa
    4. Called open ios/Runner.xcworkspace

    Finally checked in the XCode the Project Navigator -> Pods -> Targets Support Files -> Pods Runner -> Pods-Runner-frameworks file and it now contains readlink -f in the row 44. I suppose the -f shouldn't be there.

    The -f is coming from CocoaPods, not Flutter. @rafaellop did you file an issue with them? I don't see one.

    1. flutter create test
    2. Added google_fonts: ^4.0.3 to the pubspec.yaml
    3. I am on macOS 13.3.1 so I wasn't able to open Xcode 13.4, but I am using its toolchain on the command line to flutter build ipa. I ran flutter 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.

  17. jmagman commented on Apr 27, 2023

    @jmagman
    Member

    I am going to bump the Flutter-enforced minimum version to Xcode 14. If you're seeing this:

    I strongly suggest filing an issue with CocoaPods with reproduction steps.

    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.

  18. github-actions commented on May 12, 2023

    @github-actions

    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 -v and a minimal reproduction of the issue.

  19. locked as resolved and limited conversation to collaborators on May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versiont: xcode"xcodebuild" on iOS and general Xcode project managementtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions