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

15.0.0-cli on Xcode 14 : PhaseScriptExecution failed #780

Closed
1 task
pedjavujic opened this issue Nov 24, 2022 · 30 comments
Closed
1 task

15.0.0-cli on Xcode 14 : PhaseScriptExecution failed #780

pedjavujic opened this issue Nov 24, 2022 · 30 comments

Comments

@pedjavujic
Copy link

pedjavujic commented Nov 24, 2022

Bug report

CHECKLIST

  • I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
  • [x ] I have checked that no similar issues (open or closed) already exist.

Hi,

I am trying to use a new version of plugin 15.0.0-cli on Volt.Built with Xcode 14 but i am getting error:

`Code Signing /Users/vagrant/Library/Developer/Xcode/DerivedData/ZiE_TEST_APP-cwvqkqvtqskzrhehtjhaesuaccsh/Build/Intermediates.noindex/ArchiveIntermediates/ZiE TEST APP/InstallationBuildProductsLocation/Applications/ZiE TEST APP.app/Frameworks/AppAuth.framework with Identity iPhone Developer: Pedja Vujic (73S873NL2Y)
/usr/bin/codesign --force --sign F927C56AE9B2A694BEB53E5F521C3A40AC38EDA9 --preserve-metadata=identifier,entitlements '/Users/vagrant/Library/Developer/Xcode/DerivedData/ZiE_TEST_APP-cwvqkqvtqskzrhehtjhaesuaccsh/Build/Intermediates.noindex/ArchiveIntermediates/ZiE TEST APP/InstallationBuildProductsLocation/Applications/ZiE TEST APP.app/Frameworks/AppAuth.framework'
/Users/vagrant/Library/Developer/Xcode/DerivedData/ZiE_TEST_APP-cwvqkqvtqskzrhehtjhaesuaccsh/Build/Intermediates.noindex/ArchiveIntermediates/ZiE TEST APP/InstallationBuildProductsLocation/Applications/ZiE TEST APP.app/Frameworks/AppAuth.framework: errSecInternalComponent
Command PhaseScriptExecution failed with a nonzero exit code

warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'abseil' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-Core' from project 'Pods')
warning: Run script build phase 'Create Symlinks to Header Folders' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'gRPC-C++' from project 'Pods')
** ARCHIVE FAILED **

The following build commands failed:
PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/vagrant/Library/Developer/Xcode/DerivedData/ZiE_TEST_APP-cwvqkqvtqskzrhehtjhaesuaccsh/Build/Intermediates.noindex/ArchiveIntermediates/ZiE\ TEST\ APP/IntermediateBuildFilesPath/ZiE\ TEST\ APP.build/Debug-iphoneos/ZiE\ TEST\ APP.build/Script-F8F0351AC0D69FFA3D0CB7CE.sh (in target 'ZiE TEST APP' from project 'ZiE TEST APP')
(1 failure)
xcodebuild: Command failed with exit code 65`

Any idee how to solve this?

Thanks

@dpa99c
Copy link
Owner

dpa99c commented Nov 24, 2022

Is "Volt.Built" a cloud-based build service?
If so, it's probably not executing the Cordova hook scripts which this plugin uses to manipulate the native Xcode project in order to make the build succeed.
i.e. same problem as Phonegap Build: https://github.com/dpa99c/cordova-plugin-firebasex#phonegap-build

@dpa99c dpa99c closed this as completed in f2f0fdc Nov 24, 2022
@dpa99c
Copy link
Owner

dpa99c commented Nov 24, 2022

Note added to the docs clarifying that remote cloud build environments are not supported and why:
https://github.com/dpa99c/cordova-plugin-firebasex#remote-cloud-build

@gwhenne
Copy link

gwhenne commented Nov 24, 2022

@dpa99c - thanks for the help. We have a number of users with this issue.

I'm one of the devs for VoltBuilder. I turned off all restrictions on hooks and tried the job again:

Discovered plugin "cordova-plugin-firebasex". Adding it to the project
Installing "cordova-plugin-firebasex" for ios
Running command: pod install --verbose
Failed to install 'cordova-plugin-firebasex': Error: pod: Command failed with exit code 31
    at ChildProcess.whenDone (/node_modules/cordova-common/src/superspawn.js:136:25)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:313:12)
pod: Command failed with exit code 31

Any ideas?

The plugin worked great until Xcode 14.

@dpa99c
Copy link
Owner

dpa99c commented Nov 24, 2022

@gwhenne it looks like the pod install step is failing.
If this were a local build environment, I would recommend running pod repo update to ensure the latest pods are available on the build machine. I would also recommend running pod install --verbose manually from <project>/platforms/ios/ to see if there's any clues to the failure in the output.

@gwhenne
Copy link

gwhenne commented Nov 27, 2022

@dpa99c - you're correct. The pods were out of date.

However, it's still the same error message. VoltBuilder does support Cordova hook scripts. Is there any way to tell if the hook scripts are succeeding?

@dpa99c
Copy link
Owner

dpa99c commented Nov 27, 2022

@gwhenne Try running pod install --verbose manually from <project>/platforms/ios/ to see if there's any clues to the failure in the output.

@gwhenne
Copy link

gwhenne commented Nov 29, 2022

Thanks, @dpa99c - very helpful post!

I looked at my log to see if the message is there. It is:

Adding cordova-plugin-firebasex to package.json
cordova-plugin-firebasex: Preparing Firebase on iOS
cordova-plugin-firebasex: cordova-plugin-firebasex: Applied post install block to Podfile
cordova-plugin-firebasex: Updating installed Pods

So the problem does not appear to be the hooks. I'll see if I can get the pod install --verbose results next.

@gwhenne
Copy link

gwhenne commented Nov 29, 2022

Here's the output from pod install --verbose I don't see any clues - maybe you do?
pod install.log

@dpa99c
Copy link
Owner

dpa99c commented Nov 29, 2022

The pod installation was successful so it must be the build step failing. Try cordova build ios --verbose to see if that will cause xcodebuild to give any additional info.

@gwhenne
Copy link

gwhenne commented Nov 29, 2022

cordova build ios is successful, but builds for the simulator.
cordova build.log

cordova build ios --device --debug --verbose exhibits the error
cordova build device debug.log

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

Building for Simulator does not require code signing however building for device does so this could be the issue.

In cordova build device debug.log the following lines indicate that code signing has failed:

2022-11-29 11:54:35.522 xcodebuild[86185:606964] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/hn/rgqpp2hd0mzf082b33y_g8b80000gn/T/ZiE WERK APP_2022-11-29_11-54-35.521.xcdistributionlogs".
error: exportArchive: Code signing "AppAuth.framework" failed.

Error Domain=IDEDistributionPipelineErrorDomain Code=0 "Code signing "AppAuth.framework" failed." UserInfo={NSLocalizedDescription=Code signing "AppAuth.framework" failed., NSLocalizedRecoverySuggestion=View distribution logs for more information.}

The file /var/folders/hn/rgqpp2hd0mzf082b33y_g8b80000gn/T/ZiE WERK APP_2022-11-29_11-54-35.521.xcdistributionlogs should contain more info.

Do you have a build.json file in the project root directory to configure the signing credentials for the Cordova iOS build?
i.e.

{
  "ios": {
    "debug": {
      "automaticProvisioning": true,
      "developmentTeam": "<Your Apple Team ID>",
      "packageType": "development"
    },
    "release": {
      "automaticProvisioning": true,
      "developmentTeam": "<Your Apple Team ID>",
      "packageType": "app-store"
    }
  }
}

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

Here it is:

{
  "ios": {
    "debug": {
      "automaticProvisioning": false,
      "buildFlag": [
        "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
        "CODE_SIGNING_ALLOWED = YES",
        "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
        "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
      ],
      "codeSignIdentity": "iPhone Developer: xxx",
      "developmentTeam": "yyy",
      "packageType": "development",
      "provisioningProfile": "zzz"
    }
  }
}

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

Those build flags may be the problem, particularly "CODE_SIGNING_ALLOWED = YES" as this is contrary to this line of the pod post-install script which was added to fix CLI build errors using Xcode 14.

If I run cordova build ios --device in the example project using a build.json as above, the build is successful:
build_ios_device.log

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

I tried building it without the CODE_SIGNING_ALLOWED line, with it set to NO, and without any build flags at all. Same result each time.

What does your build.json file look like? I'm not sure what this sentence is referring to.

If I run cordova build ios --device in the example project using a build.json as above

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

My build.json:

{
  "ios": {
    "debug": {
      "automaticProvisioning": true,
      "developmentTeam": "<Your Apple Team ID>",
      "packageType": "development"
    },
    "release": {
      "automaticProvisioning": true,
      "developmentTeam": "<Your Apple Team ID>",
      "packageType": "app-store"
    }
  }
}

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

Hmmm... how does it even work if you don't specify codeSignIdentity and provisioningProfile? If I leave those out, my build fails almost immediately.

If I include those, I get the usual error.

The certs seem to be correct - the same project builds fine with Xcode 13.

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

AFAIK "automaticProvisioning": true is the same as checking "Automatically manage signing" in the Xcode GUI - Xcode manages signing and generates whatever provisioning profiles etc are needed - I always use that setting.

auto

So I guess "automaticProvisioning": false is the same as having that box unchecked and selecting the Provisioning Profile yourself

manual

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

I think you're right: "automaticProvisioning": true depends on the identity being set up properly in Xcode. Passing the values through build.json should work in this case: it's according to Cordova's docs and has worked in thousands of apps for us.

I wonder if there is some other factor at play here. I'll run some tests here - let me know if you think of anything.

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

Just tried building that same app, but without cordova-plugin-firebasex. It completes successfully.

It looks like something in the processing of the plugin breaks signing.

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

This plugin is quite a thin wrapper around the native Firebase iOS SDK which pulls in lots of 3rd party dependencies. Google of course does not support this usage within Cordova or CLI builds so there is no official support from them.

I would suggest building the example project with appropriate reconfiguration as it's a known codebase in order to validate the build environment and rule out possible causes in the project you are building such as conflicts with other plugins.

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

Just finished a team meeting on this. We'll try the following:

  • build using your example project
  • strip our test project down to the minimal case
  • look over the plugin code to see if we can spot anything

We also thought it would be a useful data point to see if you can build without automatic provisioning. Could you give that a try?

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

Here's the build log from a successful build of the example project with manual provisioning using following build.json:

{
  "ios": {
    "debug": {
      "automaticProvisioning": false,
      "buildFlag": [
        "EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
        "CODE_SIGNING_ALLOWED = YES",
        "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
        "LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
      ],
      "codeSignIdentity": "iPhone Developer",
      "developmentTeam": "556F3DRHUD",
      "packageType": "development",
      "provisioningProfile": "cb6f4c00-32d9-4b85-a727-4f34c798b431"
    }
  }
}

build.log

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

Just built your example project, using our certs. No automatic provisioning. It looks like it fails the same way.

Code Signing /Users/vagrant/Library/Developer/Xcode/DerivedData/FirebaseTest-ecxlruwmbbtotegvcuovhzljioyw/Build/Intermediates.noindex/ArchiveIntermediates/FirebaseTest/InstallationBuildProductsLocation/Applications/FirebaseTest.app/Frameworks/AppAuth.framework with Identity iPhone Developer: Pedja Vujic (73S873NL2Y)
/usr/bin/codesign --force --sign F927C56AE9B2A694BEB53E5F521C3A40AC38EDA9  --preserve-metadata=identifier,entitlements '/Users/vagrant/Library/Developer/Xcode/DerivedData/FirebaseTest-ecxlruwmbbtotegvcuovhzljioyw/Build/Intermediates.noindex/ArchiveIntermediates/FirebaseTest/InstallationBuildProductsLocation/Applications/FirebaseTest.app/Frameworks/AppAuth.framework'
/Users/vagrant/Library/Developer/Xcode/DerivedData/FirebaseTest-ecxlruwmbbtotegvcuovhzljioyw/Build/Intermediates.noindex/ArchiveIntermediates/FirebaseTest/InstallationBuildProductsLocation/Applications/FirebaseTest.app/Frameworks/AppAuth.framework: errSecInternalComponent
Command PhaseScriptExecution failed with a nonzero exit code

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

Googling AppAuth.framework: errSecInternalComponent comes up with this possible answer

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

A problem with the certs is always a possibility, if Xcode 14 changed the handling. I'm now even more curious what happens when you try your sample project with your certs, but with manual provisioning.

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

I'm now even more curious what happens when you try your sample project with your certs, but with manual provisioning.

As above, my CLI build of the example project with manual provisioning (based on your build.json) was successful

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

As above, my CLI build of the example project with manual provisioning (based on your build.json) was successful

Sorry - missed that. Our replies overlapped.

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

Next thing to try might be to submit your job with your certs to the Voltbuilder server. That would determine whether the certs are the issue.

To do that, you'd need to share your certs with me, or add a couple of files to your project and submit it yourself. Are you game for one of these options?

@dpa99c
Copy link
Owner

dpa99c commented Nov 30, 2022

Sure but it will have to be tomorrow as my wife has got jobs for me now - I'll share the creds direct via email as I don't want to commit them to a public repo

@gwhenne
Copy link

gwhenne commented Nov 30, 2022

Sounds good - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants