nativescript-cli: Cant build since Xcode 10

Did you verify this is a real problem by searching the [NativeScript Forum]

Found a related issue: https://stackoverflow.com/questions/52340033/xcodebuild-failed-exit-code-65-ios

Tell us about the problem

After updating to Xcode 10 (today), my tns run ios --log trace fails on the xcode build step with:

stderr: 
spawn: xcodebuild "archive" "-archivePath" "./platforms/ios/build/archive/ourApp.xcarchive" "-configuration" "Debug" "-workspace" "./platforms/ios/ourApp.xcworkspace" "-scheme" "ourApp" "SHARED_PRECOMPS_DIR=./platforms/ios/build/sharedpch" "ARCHS=arm64" "VALID_ARCHS=arm64" "-sdk" "iphoneos" "CONFIGURATION_BUILD_DIR=./platforms/ios/build/device" "-allowProvisioningUpdates"
User defaults from command line:
    IDEArchivePathOverride = ./platforms/ios/build/archive/ourApp.xcarchive

Build settings from command line:
    ARCHS = arm64
    CONFIGURATION_BUILD_DIR = ./platforms/ios/build/device
    SDKROOT = iphoneos12.0
    SHARED_PRECOMPS_DIR = ./platforms/ios/build/sharedpch
    VALID_ARCHS = arm64

note: Using new build system
note: Planning build
note: Constructing build description
Build system information
error: unexpected duplicate task: CodeSign <my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework (in target 'ourApp')

Build system information
error: unexpected duplicate task: CodeSign <my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework (in target 'ourApp')

Build system information
error: Multiple commands produce '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework/TNSCore':
1) Target 'ourApp' has copy command from './node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework'
2) Target 'ourApp' has copy command from './node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework'

Build system information
error: Multiple commands produce '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework':
1) Target 'ourApp' has copy command from './node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework'
2) Target 'ourApp' has copy command from './node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework'

Build system information
warning: duplicate output file '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework' on task: PBXCp ./node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework <my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework (in target 'ourApp')

Build system information
warning: duplicate output file '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework/TNSCore' on task: PBXCp ./node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework <my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework (in target 'ourApp')

Build system information
warning: duplicate output file '' on task: PBXCp ./node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework <my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework (in target 'ourApp')

Command xcodebuild failed with exit code 65
Unable to apply changes on device: a1f50f93c3c6c8473b2ce8a5ceafe1ddbd5cb753. Error is: Command xcodebuild failed with exit code 65.

(I’ve anonymized the output)

I have the entire trace log output if anyone needs it.

Not sure if the error could be related to having the xcode update run in the background, while xcodebuild being used from the commandline. I’ve tried doing a tns update, but it didn’t fix the issue.

Which platform(s) does your issue occur on?

MacOS 10.13.6 (High Sierra)

Please provide the following version numbers that your issue occurs with:

  • CLI: 4.2.3
  • Cross-platform modules: 4.2.0
  • Runtime(s): 4.2.0 & 4.2.0
  • Plugin(s):
  "dependencies": {
    "@angular/animations": "~6.1.0",
    "@angular/common": "~6.1.0",
    "@angular/compiler": "~6.1.0",
    "@angular/core": "~6.1.0",
    "@angular/forms": "~6.1.0",
    "@angular/http": "~6.1.0",
    "@angular/platform-browser": "~6.1.0",
    "@angular/platform-browser-dynamic": "~6.1.0",
    "@angular/router": "~6.1.0",
    "@ngx-translate/core": "^10.0.2",
    "nativescript-angular": "^6.1.0",
    "nativescript-plugin-firebase": "^6.8.1",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-listview": "^3.6.1",
    "nativescript-ui-sidedrawer": "~4.2.0",
    "reflect-metadata": "~0.1.10",
    "rxjs": "^6.3.2",
    "tns-core-modules": "^4.2.0",
    "zone.js": "~0.8.18"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~6.1.0",
    "@nativescript/schematics": "~0.2.5",
    "@ngtools/webpack": "~6.2.0",
    "codelyzer": "~4.3.0",
    "nativescript-dev-sass": "~1.6.0",
    "nativescript-dev-typescript": "~0.7.0",
    "nativescript-dev-webpack": "~0.16.0",
    "tns-platform-declarations": "^4.2.0",
    "tslint": "~5.11.0",
    "typescript": "~2.7.2"
  },

Please tell us how to recreate the issue in as much detail as possible.

Not sure how to recreate if it doesn’t fail on a fresh upgrade of xcode 10 in your end.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 6
  • Comments: 66 (26 by maintainers)

Most upvoted comments

Yes, that fixes it. I managed to reproduce the error with your versions, and it got fixed after upgrading. It seems that the old build system has tolerated this inconsistency and has silently selected one of the 2 frameworks, while the new one is stricter and treats this as an error.

It seems that I spoke too fast – ListView is already the latest but SideDrawer is not. I suggest you upgrade it as well.

Hi @larssn, looking at this error I can see that there are multiple TNSCore.frameworks in you node_modules directory:

error: Multiple commands produce '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework/TNSCore':
1) Target 'ourApp' has copy command from './node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework'
2) Target 'ourApp' has copy command from './node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '<my-user>/Library/Developer/Xcode/DerivedData/ourApp-axpwxekjlqemgxhcqrekmksxyout/Build/Intermediates.noindex/ArchiveIntermediates/ourApp/InstallationBuildProductsLocation/Applications/ourApp.app/Frameworks/TNSCore.framework'

Probably this is due to the fact that you have different major versions for ListView and SideDrawer:

    "nativescript-ui-listview": "^3.6.1",
    "nativescript-ui-sidedrawer": "~4.2.0"

I suppose that upgrading ListView will fix the error.

Do you have a package-lock.json? It could be forcing NPM to duplicate the module. Simply delete it if it exists.

sudo react-native init project working fine with me

Yes.

This is related to another issue that we found with Xcode 10. The fix has already been published in NPM as nativescript@next. You can upgrade NativeScript CLI and try again.

Refs: https://github.com/NativeScript/nativescript-cli/issues/3920

@mbektchiev that was it! Cocoapods version was 1.3.1. After upgrading to 1.5.3 all is back to normal

@peppeg85 Can you send us more information about the crash? Some device logs for example and what kind of crash it is (e.g. Unhandled exception, signal, Access violation). You can refer to this docs section for guidelines how to obtain diagnostic logs from the device if tns run’s output seems to be incomplete for some reason.

@ignaciofuentes We couldn’t reproduce the error that you see. Can you tell us the exact version strings of CocoaPods and Xcode on your machine? You can send us the outputs of pod --version, xcodebuild -version commands. It seems that the cause is the plugin’s CocoaPod reference. With the latest versions (Xcode 10.0 Build version 10A255 and CocoaPods - 1.5.3) there’s no such error.

Please reopen the issue @larssn

I found a solution, see the bottom of this comment.

I’m having the same problem described here.

I did execute the following commands:

rm -rf node_modules
rm -rf platforms
rm package-lock.json
npm i
pod repo update
tns run ios

I’m still facing the issue. I will try switching to the Legacy Build System now.

Here’s the (anonymized) build system log:

Xcode build...
error: unexpected duplicate task: CodeSign /path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework (in target 'MyApp')
error: unexpected duplicate task: CodeSign /path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework (in target 'MyApp')
error: Multiple commands produce '/path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework':
1) Target 'MyApp' has copy command from '/path/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '/path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework'
2) Target 'MyApp' has copy command from '/path/node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '/path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework'
error: Multiple commands produce '/path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework/TNSCore':
1) Target 'MyApp' has copy command from '/path/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '/path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework'
2) Target 'MyApp' has copy command from '/path/node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework' to '/path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework'
warning: duplicate output file '/path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework' on task: PBXCp /path/node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework /path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework (in target 'MyApp')
warning: duplicate output file '/path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework/TNSCore' on task: PBXCp /path/node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework /path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework (in target 'MyApp')
warning: duplicate output file '' on task: PBXCp /path/node_modules/nativescript-ui-listview/node_modules/nativescript-ui-core/platforms/ios/TNSCore.framework /path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework (in target 'MyApp')
note: Using new build systemnote: Planning buildnote: Constructing build description
** BUILD FAILED **

Dependencies:

"dependencies": {
    "@angular/animations": "~6.1.0",
    "@angular/common": "~6.1.0",
    "@angular/compiler": "~6.1.0",
    "@angular/core": "~6.1.0",
    "@angular/forms": "~6.1.0",
    "@angular/http": "~6.1.0",
    "@angular/platform-browser": "~6.1.0",
    "@angular/platform-browser-dynamic": "~6.1.0",
    "@angular/router": "~6.1.0",
    "@ngrx/effects": "^6.1.0",
    "@ngrx/store": "^6.1.0",
    "nativescript-angular": "^6.1.0",
    "nativescript-feedback": "^1.2.0",
    "nativescript-imagepicker": "~5.0.0",
    "nativescript-loading-indicator": "^2.4.0",
    "nativescript-localize": "^3.0.5",
    "nativescript-localstorage": "^1.1.5",
    "nativescript-plugin-firebase": "^6.4.1",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-tslib": "^1.9.1-r1",
    "nativescript-ui-listview": "^3.7.0",
    "ngrx-store-localstorage": "^5.0.1",
    "ngrx-store-logger": "^0.2.2",
    "reflect-metadata": "~0.1.10",
    "rxjs": "^6.0.0",
    "tns-core-modules": "^4.2.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~6.1.0",
    "@ngtools/webpack": "~6.2.0",
    "codelyzer": "~4.3.0",
    "nativescript-dev-sass": "~1.6.0",
    "nativescript-dev-typescript": "^0.7.4",
    "nativescript-dev-webpack": "^0.16.1",
    "tns-platform-declarations": "^4.2.0",
    "tslint": "~5.10.0",
    "typescript": "~2.7.2"
  }

EDIT

After switching to the Legacy Build System I was not able to build successfully. I had to execute the erase all contents and settings feature from the iOS Simulator first.

Now I’m able to build using Xcode directly. tns run ios still fails with the following (anonymized) output:

Xcode build...
=== BUILD TARGET MyApp OF PROJECT MyApp WITH CONFIGURATION Debug ===
Warning: Multiple build commands for output file /path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework
=== BUILD TARGET MyApp OF PROJECT MyApp WITH CONFIGURATION Debug ===
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/UIKit-1V5UHAPTOD24G.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/UIKit-1V5UHAPTOD24G.pcm
note: Linking a static library that was built with -gmodules, but the module cache was not found.  Redistributable static libraries should never be built with module debugging enabled.  The debug experience will be degraded due to incomplete debug information.
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/Darwin-38I6DLZ5IH61J.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/Darwin-38I6DLZ5IH61J.pcm
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/Foundation-3DFYNEBRQSXST.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/Foundation-3DFYNEBRQSXST.pcm
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/Dispatch-2LX9MWM6UEPQW.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/Dispatch-2LX9MWM6UEPQW.pcm
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/ObjectiveC-1R06XOY9T4FIM.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Y0LVQ9G7OBT/ObjectiveC-1R06XOY9T4FIM.pcm
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/UIKit-1V5UHAPTOD24G.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/UIKit-1V5UHAPTOD24G.pcm
note: Linking a static library that was built with -gmodules, but the module cache was not found.  Redistributable static libraries should never be built with module debugging enabled.  The debug experience will be degraded due to incomplete debug information.
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/Darwin-38I6DLZ5IH61J.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/Darwin-38I6DLZ5IH61J.pcm
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/Foundation-3DFYNEBRQSXST.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/Foundation-3DFYNEBRQSXST.pcm
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/Dispatch-2LX9MWM6UEPQW.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/Dispatch-2LX9MWM6UEPQW.pcm
warning: /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/ObjectiveC-1R06XOY9T4FIM.pcm: No such file or directory
note: while processing /Users/nsbuilduser/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/9G23JDZCI6P8/ObjectiveC-1R06XOY9T4FIM.pcm
error: make directory /path/platforms/ios/build/emulator/MyApp.app/Frameworks/TNSCore.framework: File exists
2018-09-23 06:05:27.628 xcodebuild[7528:129524]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-14306.16/Xcode3Core/LegacyProjects/Frameworks/DevToolsCore/DevToolsCore/BuildSystem/Runtime/PBXTargetBuildContext.mm:757
Details:  unexpected successful exit code from cancelled command <C0029:'PBXCp TNSListView.framework':P16>
Object:   <PBXTargetBuildContext: 0x7fa3974e7b50>
Method:   -createCommandInvocationRecordFromInvocation:
Thread:   <NSThread: 0x7fa397b9f330>{number = 10, name = (null)}
Please file a bug at https://bugreport.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **

Here’s my tns doctor output:

✔ Getting environment information 

No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 4.2.4 version and is up to date.
✔ Component tns-core-modules has 4.2.1 version and is up to date.
✖ Component tns-android is not installed.
✔ Component tns-ios has 4.2.0 version and is up to date.

Solution:

I’ve managed to find the root of all evil:

npm list nativescript-ui-core
├─┬ nativescript-imagepicker@5.0.2
│ └── nativescript-ui-core@1.0.1 
└─┬ nativescript-ui-listview@3.7.0
  └── nativescript-ui-core@2.0.0 

Fix:

tns plugin update nativescript-imagepicker
npm dedupe

Now everything’s working like a charm. Even with the new build system.

Hey @larssn , Have you tried removing your platforms directory and building your project again (after fixing the package-lock.json issue) ?