5

I am new to flutter. The android section build successfully, but the Xcode section is failing to build. Can someone point me to what I need to do? (in VSCode or Xcode). The last things I did were 1) Delete /iOS/Pods, Podfile.lock, Runner.xcworksp. 2) Reinstall Pod (Pod Install), 3) ran Product - Clean Build Folder, but the build process still failed.

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/carlton/Library/Developer/Xcode/DerivedData/Runner-cjhgzdyvgdocfpacsknvjdqyoncu/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-8CA7D70C2DA13E40FDD92FF3.sh (in target 'Runner' from project 'Runner')
    cd /Users/carlton/Desktop/development/churchevent/ios
    /bin/sh -c /Users/carlton/Library/Developer/Xcode/DerivedData/Runner-cjhgzdyvgdocfpacsknvjdqyoncu/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-8CA7D70C2DA13E40FDD92FF3.sh

mkdir -p /Users/carlton/Library/Developer/Xcode/DerivedData/Runner-cjhgzdyvgdocfpacsknvjdqyoncu/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/carlton/Desktop/development/churchevent/ios/Pods/../Flutter/Flutter.framework" "/Users/carlton/Library/Developer/Xcode/DerivedData/Runner-cjhgzdyvgdocfpacsknvjdqyoncu/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks"
building file list ... done
Flutter.framework/
Flutter.framework/Flutter
Flutter.framework/Info.plist
Flutter.framework/icudtl.dat
Flutter.framework/_CodeSignature/
Flutter.framework/_CodeSignature/CodeResources

sent 94963025 bytes  received 120 bytes  189926290.00 bytes/sec
total size is 94951038  speedup is 1.00
/Users/carlton/Desktop/development/churchevent/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh: line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code


Showing Recent Issues

Build target Runner of project Runner with configuration Debug
warning: There are no architectures to compile for because the VALID_ARCHS build setting is an empty list. (in target 'Runner' from project 'Runner')


PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/carlton/Library/Developer/Xcode/DerivedData/Runner-cjhgzdyvgdocfpacsknvjdqyoncu/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-8CA7D70C2DA13E40FDD92FF3.sh (in target 'Runner' from project 'Runner')
    cd /Users/carlton/Desktop/development/churchevent/ios
    /bin/sh -c /Users/carlton/Library/Developer/Xcode/DerivedData/Runner-cjhgzdyvgdocfpacsknvjdqyoncu/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Script-8CA7D70C2DA13E40FDD92FF3.sh

mkdir -p /Users/carlton/Library/Developer/Xcode/DerivedData/Runner-cjhgzdyvgdocfpacsknvjdqyoncu/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "/Users/carlton/Desktop/development/churchevent/ios/Pods/../Flutter/Flutter.framework" "/Users/carlton/Library/Developer/Xcode/DerivedData/Runner-cjhgzdyvgdocfpacsknvjdqyoncu/Build/Products/Debug-iphonesimulator/Runner.app/Frameworks"
building file list ... done
Flutter.framework/
Flutter.framework/Flutter
Flutter.framework/Info.plist
Flutter.framework/icudtl.dat
Flutter.framework/_CodeSignature/
Flutter.framework/_CodeSignature/CodeResources

sent 94963025 bytes  received 120 bytes  189926290.00 bytes/sec
total size is 94951038  speedup is 1.00
/Users/carlton/Desktop/development/churchevent/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh: line 144: ARCHS[@]: unbound variable
Command PhaseScriptExecution failed with a nonzero exit code

HERE IS THE CODE WITH LINE 144

# Strip invalid architectures
strip_invalid_archs() {
  binary="$1"
  warn_missing_arch=${2:-true}
  # Get architectures for current target binary
  binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
  # Intersect them with the architectures we are building for
  intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
  # If there are no archs supported by this binary then warn the user
  if [[ -z "$intersected_archs" ]]; then
    if [[ "$warn_missing_arch" == "true" ]]; then
      echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
    fi
    STRIP_BINARY_RETVAL=0
    return
  fi
  stripped=""
  for arch in $binary_archs; do
    if ! [[ "${ARCHS}" == *"$arch"* ]]; then
      # Strip non-valid architectures in-place
      lipo -remove "$arch" -output "$binary" "$binary"
      stripped="$stripped $arch"
    fi
  done
  if [[ "$stripped" ]]; then
    echo "Stripped $binary of architectures:$stripped"
  fi
  STRIP_BINARY_RETVAL=1
}
1
  • This is the code for line 144 -> intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" Commented Mar 27, 2020 at 23:28

1 Answer 1

0

Could you provide a flutter doctor --verbose logs? The error "Unbound Variable Command PhaseScriptExecution failed with a nonzero exit code" is thrown by CocoaPods, not directly caused by Flutter SDK. You can try the suggestions posted on this GitHub issue thread https://github.com/CocoaPods/CocoaPods/issues/8035 and see which one may work for you. On my tests, deleting /iOS/Pods, Podfile.lock, Runner.xcworkspace gets regenerated after flutter run.

For reference, here's my flutter doctor logs

[✓] Flutter (Channel master, 1.26.0-2.0.pre.281, on macOS 11.1 20C69 darwin-x64)
    • Flutter version 1.26.0-2.0.pre.281
    • Framework revision 4d5db88998 (3 weeks ago), 2021-01-11 10:29:26 -0800
    • Engine revision d5cacaa3a6
    • Dart version 2.12.0 (build 2.12.0-211.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Platform android-30, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.0.1, Build version 12A7300
    • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.52.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.18.1

[✓] Connected device (2 available)
    • AOSP on IA Emulator (mobile) • emulator-5554 • android-x86    • Android 9 (API 28) (emulator)
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 88.0.4324.96

• No issues found!
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.