Skip to content

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

@rafaellop

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

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