Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command PhaseScriptExecution failed with a nonzero exit code #49495

Closed
dpedrinha opened this issue Jan 26, 2020 · 19 comments
Closed

Command PhaseScriptExecution failed with a nonzero exit code #49495

dpedrinha opened this issue Jan 26, 2020 · 19 comments
Labels
a: build Building flutter applications with the tool c: crash Stack traces logged to the console platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@dpedrinha
Copy link

dpedrinha commented Jan 26, 2020

I'm having trouble archiving an ios app. It was working fine yesterday, today it stoped working.

I can run the app on the simulator with flutter run and I can do flutter build ios without errors. But when I go to XCode to Archive it, it throws this weird error:

/bin/sh: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

Been frying my brains since yesterday and I can't find the problem or a solution online.

Steps to Reproduce

  1. Run flutter build ios.
  2. Close VSCode
  3. Open XCode
  4. Product -> Archive = error

Expected results:
No error
Actual results:
/bin/sh: /packages/flutter_tools/bin/xcode_backend.sh: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

Logs

info • 'body1' is deprecated and shouldn't be used. This is the term used in the 2014 version of material design. The
          modern term is bodyText2. This feature was deprecated after v1.13.8. • lib/main.dart:58:15 •
          deprecated_member_use

1 issue found. (ran in 5.7s)
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
[✓] Flutter (Channel master, v1.14.5-pre.35, on Mac OS X 10.15.2 19C57, locale pt-BR)
    • Flutter version 1.14.5-pre.35 at /Users/daniel/dev/flutter
    • Framework revision 4fbb85e0c2 (7 hours ago), 2020-01-25 15:34:37 -0500
    • Engine revision 6fa1fcda8f
    • Dart version 2.8.0 (build 2.8.0-dev.5.0 fc3af737c7)

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/daniel/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /usr/bin/java
    ✗ Could not determine java version

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.8.4

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).

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

[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.
@jonahwilliams
Copy link
Member

/packages/flutter_tools/bin/xcode_backend.sh

This file is located in the flutter SDK, can you confirm that it exists? If not was it deleted? You will need to restore it (using git) or re-download flutter

@jonahwilliams jonahwilliams added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 26, 2020
@dpedrinha
Copy link
Author

dpedrinha commented Jan 26, 2020

Yes, it exists.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Jan 26, 2020
@dpedrinha
Copy link
Author

dpedrinha commented Jan 26, 2020

I added a FLUTTER_ROOT variable to the Build Settings-> User-defined pointing to my flutter directory /Users/myuser/dev/flutter and the archive was build.

But I read somewhere that this is not advisable to do, and that it shouldn't be necessary, so the problem persists. I don't know the consequences of adding it but it's a temporary workaround.

One possible consequence is that now I got a response from apple with the following message. I wasn't getting this before and I didn't change anything but a few lines of code since the last archive build. I don't even know what that means.

Dear Developer,

We identified one or more issues with a recent delivery for your app, "App Name" 6.0.6 (204). Your delivery was successful, but you may wish to correct the following issues in your next delivery:

ITMS-90381: Too many symbol files - These symbols have no corresponding slice in any binary [21445947-8CB3-35A3-BC25-4A6FAAD91DB1.symbols, A91778CC-3C2E-30C1-A2CE-5F782040B143.symbols, 47BA46A8-01A3-3535-A857-33608C98DBC9.symbols, 3D6354E1-7749-32BE-A709-CA302D514E18.symbols, 8CEFAE31-9C58-35CD-A576-B7A6A8CE766A.symbols, 052CBDAC-AF89-3D31-BC0D-7EC7F98FF3B0.symbols, 0B85F2D3-F38F-332D-8498-FB7F1C0ECF3A.symbols, 1F46C45E-2BCB-3EFF-9949-BD53F801E51E.symbols, 6C5D68B0-3705-37E8-A6F2-B59887EAFC38.symbols, 2D699377-49C0-3E13-886F-955FC8B0825D.symbols, 84935D3A-07B4-3979-B919-29571C48901C.symbols, 8BB1A3E6-62AA-3AAE-8FA2-78ED428863CB.symbols, 2BC5656F-C2A2-3161-8E67-5779B3C9055A.symbols, 2E997F4D-497D-3745-9DA6-5773F13D55A7.symbols, C1CCBE3E-E0CB-3A2A-8D69-0E0769875284.symbols, F6BAFC0F-1D98-3C4E-BE8F-1AF4A70F3ED0.symbols, B943F468-8598-386A-BB5F-5B38EB5663F4.symbols, C067AB62-1D03-3A02-ADAE-4C15166C964F.symbols].

After you’ve corrected the issues, you can upload a new binary to App Store Connect.

Best regards,

The App Store Team

@jonahwilliams
Copy link
Member

Have you run flutter build ios ever? That should generate an xcconfig file that contains a populated FLUTTER_ROOT variable. The issue you've included doesn't seem to be related...

@dpedrinha
Copy link
Author

dpedrinha commented Jan 26, 2020

Have you run flutter build ios ever? That should generate an xcconfig file that contains a populated FLUTTER_ROOT variable. The issue you've included doesn't seem to be related...

Yes, I always run flutter build ios before even opening Xcode and archiving.

This is the Generated.xcconfig content:

// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/myuser/dev/flutter
FLUTTER_APPLICATION_PATH=/Users/myuser/dev/apps/myappname
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
FLUTTER_FRAMEWORK_DIR=/Users/myuser/dev/flutter/bin/cache/artifacts/engine/ios-release
FLUTTER_BUILD_NAME=6.1.3
FLUTTER_BUILD_NUMBER=205

It's pointing to the exact same path. But for some reason it's not working. Any ideas?

About the other problem, well it happened now for the first time and all I changed was a few lines of code that shouldn't have this kind of impact. I'm just sharing everything relevant to help finding a solution.

@iapicca iapicca added a: build Building flutter applications with the tool framework flutter/packages/flutter repository. See also f: labels. platform-ios iOS applications specifically c: crash Stack traces logged to the console labels Jan 27, 2020
@goderbauer goderbauer added t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels. and removed framework flutter/packages/flutter repository. See also f: labels. labels Jan 30, 2020
@jmagman
Copy link
Member

jmagman commented Feb 1, 2020

Are you doing anything with flavors, or Xcode build settings?

@jmagman
Copy link
Member

jmagman commented Feb 1, 2020

What's the output of:

cd ios
xcrun xcodebuild -configuration Debug -showBuildSettings -workspace Runner.xcworkspace -scheme Runner

@jmagman jmagman added this to Awaiting triage in Tools - Xcode review via automation Feb 1, 2020
@dpedrinha
Copy link
Author

dpedrinha commented Feb 1, 2020

@jmagman
Copy link
Member

jmagman commented Feb 3, 2020

Is that output from the Archive working with your User-defined build setting? If so, can you remove it and try again?
I see this in the build settings so I would expect for the xcode_backend script to be found.

FLUTTER_ROOT = /Users/myuser/dev/flutter

@jmagman jmagman added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 3, 2020
@dpedrinha
Copy link
Author

dpedrinha commented Feb 6, 2020

Sorry for the late reply.
Yes, I needed to add this setting to be able to Archive.
I just updated flutter, removed the FLUTTER_ROOT and I got the same error. Won't Archive without it.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 6, 2020
@dpedrinha
Copy link
Author

Oh boy... Now, after a couple Flutter updates, I can't even run flutter build ios. I get the same error now on VS Code, even with the FLUTTER_ROOT set.

Now I can't archive and publish updates for my app again...

Please help.

@jmagman
Copy link
Member

jmagman commented Feb 6, 2020

Here's the trail that should make that FLUTTER_ROOT appear.

FLUTTER_ROOT should be set to the correct path in Generated.xcconfig. Sounds like for you, it is.
There's a Debug.xcconfig and Release.xcconfig. Both should have #include "Generated.xcconfig" to pull in those build settings.

Screen Shot 2020-02-06 at 11 14 11 AM

Then in your build configurations (Runner project > Info > Configurations), those Debug and Release xcconfigs should be the Based on Configuration File.

Screen Shot 2020-02-06 at 11 14 07 AM

And therefore FLUTTER_ROOT should show up in your project and target build settings.

Screen Shot 2020-02-06 at 11 13 40 AM

This is how it's all set up when you flutter create. Somewhere in your setup this chain is broken. We've most often seen this issue for people who are adding build configurations to support flavors, hence my question in #49495 (comment).

So what part of the above are you missing?

@jmagman jmagman added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 6, 2020
@dpedrinha
Copy link
Author

This is the content of both xcconfig files:

#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"

The Runner project > Info > Configurations looks exactly like in the image.

The FLUTTER_ROOT only show in the build settings if I add it.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Feb 8, 2020
@dpedrinha
Copy link
Author

dpedrinha commented Feb 11, 2020

So I tried a bunch of things like removing and adding back the configuration settings, running a bunch of flutter clean, pod install and updating flutter and xcode and apparently everything is back to normal.
I deleted the FLUTTER_ROOT and it showed there again after flutter build ios.
Thank you for the help. But I really don't know how the problem started and how it ended.

Tools - Xcode review automation moved this from Awaiting triage to Engineer reviewed Feb 11, 2020
@rkamun1
Copy link

rkamun1 commented Aug 15, 2020

Here's the trail that should make that FLUTTER_ROOT appear.

FLUTTER_ROOT should be set to the correct path in Generated.xcconfig. Sounds like for you, it is.
There's a Debug.xcconfig and Release.xcconfig. Both should have #include "Generated.xcconfig" to pull in those build settings.

Screen Shot 2020-02-06 at 11 14 11 AM

Then in your build configurations (Runner project > Info > Configurations), those Debug and Release xcconfigs should be the Based on Configuration File.

Screen Shot 2020-02-06 at 11 14 07 AM

And therefore FLUTTER_ROOT should show up in your project and target build settings.

Screen Shot 2020-02-06 at 11 13 40 AM

This is how it's all set up when you flutter create. Somewhere in your setup this chain is broken. We've most often seen this issue for people who are adding build configurations to support flavors, hence my question in #49495 (comment).

So what part of the above are you missing?

Thank you!

@alanpachuau
Copy link

Here's the trail that should make that FLUTTER_ROOT appear.

FLUTTER_ROOT should be set to the correct path in Generated.xcconfig. Sounds like for you, it is.
There's a Debug.xcconfig and Release.xcconfig. Both should have #include "Generated.xcconfig" to pull in those build settings.

Screen Shot 2020-02-06 at 11 14 11 AM

Then in your build configurations (Runner project > Info > Configurations), those Debug and Release xcconfigs should be the Based on Configuration File.

Screen Shot 2020-02-06 at 11 14 07 AM

And therefore FLUTTER_ROOT should show up in your project and target build settings.

Screen Shot 2020-02-06 at 11 13 40 AM

This is how it's all set up when you flutter create. Somewhere in your setup this chain is broken. We've most often seen this issue for people who are adding build configurations to support flavors, hence my question in #49495 (comment).

So what part of the above are you missing?

It works. Thank you. The "Based On Configuration File" is incorrectly set for my project.

@jmagman
Copy link
Member

jmagman commented Sep 14, 2020

@alanpachuau @SirBertly any idea how that was misconfigured? I've seen lots of people with the problem but don't understand how it happens. It's set up correctly in a new flutter created project. Were you messing with flavors?

@NazranKhondokar
Copy link

In my case, it is occurred for mac out of memory. It fixed after clear mac memory.

@github-actions
Copy link

github-actions bot commented Aug 7, 2021

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: build Building flutter applications with the tool c: crash Stack traces logged to the console platform-ios iOS applications specifically t: xcode "xcodebuild" on iOS and general Xcode project management tool Affects the "flutter" command-line tool. See also t: labels.
Projects
Tools - Xcode review
  
Engineer reviewed
Development

No branches or pull requests

8 participants