NativeScript / nativescript-cli

Command-line interface for building NativeScript apps
https://www.npmjs.com/package/nativescript
Apache License 2.0
1.04k stars 195 forks source link

Build fails in xcode 14 #5715

Open AlirezaNikkhah1375 opened 1 year ago

AlirezaNikkhah1375 commented 1 year ago

Issue Description

When i want to build (build will be for any IOS device(arm64) ) my app with xcode 14 on macOS, my build fails and it throws this error : note: i updated my project to latest version of native script and the old version was 8.0, even before updating error was the same.

steps that i did after cloning the project from our repository gitlab :

Xcode build... error: cannot parse the debug map for '/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/App.app/App': Is a directory note: Using codesigning identity override: note: Building targets in dependency order note: Removed stale file '/Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Script-973AF1A3183BF9AD11F59FD8.sh'

warning: Stale file '/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/sharedpch/SharedPrecompiledHeaders/4918285647815614924/App-Prefix.pch.gch' is located outside of the allowed root paths.

/Users/anikkhah/Projects/clem-test/App/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'Pods-App' from project 'Pods') /Users/anikkhah/Projects/clem-test/App/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'CouchbaseLite' from project 'Pods') note: Run script build phase 'NativeScript PreBuild' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'App' from project 'App') note: Run script build phase 'NativeScript PreLink' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'App' from project 'App') note: Run script build phase 'NativeScript PostBuild' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'App' from project 'App') BUILD FAILED

Command xcodebuild failed with exit code 65

Reproduction

steps that i did after cloning the project from our repository gitlab :

Relevant log output (if applicable)

Set nativeChanged to false.
Set value of configChanged to false
checkForChanges returns ProjectChangesInfo {
  appResourcesChanged: false,
  nativeChanged: false,
  nsConfigChanged: false,
  configChanged: false,
  nativePlatformStatus: '3'
}
Project dir from hooksArgs is: /Users/anikkhah/Projects/clem-test/App.
Hooks directories: [ '/Users/anikkhah/Projects/clem-test/App/hooks' ]
AfterHookName for command checkForChanges is after-checkForChanges
Project dir from hooksArgs is: /Users/anikkhah/Projects/clem-test/App.
Hooks directories: [ '/Users/anikkhah/Projects/clem-test/App/hooks' ]
AfterHookName for command prepareNativeApp is after-prepareNativeApp
Updating runtime package.json with configuration values...
Failed to read emitted package.json. Error is:  Error: ENOENT: no such file or directory, open '/Users/anikkhah/Projects/clem-test/App/platforms/ios/App/app/package.json'
    at Object.openSync (node:fs:594:3)
    at Object.readFileSync (node:fs:462:35)
    at FileSystem.readFile (/usr/local/lib/node_modules/nativescript/lib/common/file-system.js:192:19)
    at FileSystem.readText (/usr/local/lib/node_modules/nativescript/lib/common/file-system.js:202:21)
    at FileSystem.readJson (/usr/local/lib/node_modules/nativescript/lib/common/file-system.js:205:27)
    at PrepareController.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/controllers/prepare-controller.js:266:53)
    at Generator.next (<anonymous>)
    at /usr/local/lib/node_modules/nativescript/lib/controllers/prepare-controller.js:14:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/local/lib/node_modules/nativescript/lib/controllers/prepare-controller.js:10:12) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/Users/anikkhah/Projects/clem-test/App/platforms/ios/App/app/package.json'
}
Project successfully prepared (ios)
Project dir from hooksArgs is: /Users/anikkhah/Projects/clem-test/App.
Hooks directories: [ '/Users/anikkhah/Projects/clem-test/App/hooks' ]
AfterHookName for command prepare is after-prepare
Building project...
Project dir from hooksArgs is: /Users/anikkhah/Projects/clem-test/App.
Hooks directories: [ '/Users/anikkhah/Projects/clem-test/App/hooks' ]
BeforeHookName for command buildIOS is before-buildIOS
Xcode build...
spawn: xcodebuild "ONLY_ACTIVE_ARCH=NO" "CODE_SIGN_IDENTITY=" "-destination" "generic/platform=iOS Simulator" "build" "-configuration" "Debug" "-sdk" "iphonesimulator" "BUILD_DIR=/Users/anikkhah/Projects/clem-test/App/platforms/ios/build" "SHARED_PRECOMPS_DIR=/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/sharedpch" "-workspace" "/Users/anikkhah/Projects/clem-test/App/platforms/ios/App.xcworkspace" "-scheme" "App"
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY= -destination "generic/platform=iOS Simulator" build -configuration Debug -sdk iphonesimulator BUILD_DIR=/Users/anikkhah/Projects/clem-test/App/platforms/ios/build SHARED_PRECOMPS_DIR=/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/sharedpch -workspace /Users/anikkhah/Projects/clem-test/App/platforms/ios/App.xcworkspace -scheme App

User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES

Build settings from command line:
    BUILD_DIR = /Users/anikkhah/Projects/clem-test/App/platforms/ios/build
    CODE_SIGN_IDENTITY = 
    ONLY_ACTIVE_ARCH = NO
    SDKROOT = iphonesimulator16.2
    SHARED_PRECOMPS_DIR = /Users/anikkhah/Projects/clem-test/App/platforms/ios/build/sharedpch

Prepare packages

note: Using codesigning identity override: 
Computing target dependency graph and provisioning inputs

Create build description
Build description signature: dfa35e5e2f84bf46cbf4531d52931481
Build description path: /Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/XCBuildData/dfa35e5e2f84bf46cbf4531d52931481-desc.xcbuild

note: Building targets in dependency order
note: Run script build phase 'NativeScript PreBuild' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'App' from project 'App')
note: Run script build phase 'NativeScript PreLink' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'App' from project 'App')
note: Run script build phase 'NativeScript PostBuild' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'App' from project 'App')
PhaseScriptExecution NativeScript\ PreBuild /Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Script-C97FD7AC1ADE5369004DB2A4.sh (in target 'App' from project 'App')
    cd /Users/anikkhah/Projects/clem-test/App/platforms/ios
    /bin/sh -c /Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Script-C97FD7AC1ADE5369004DB2A4.sh

Ld /Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/App.app/App normal (in target 'App' from project 'App')
    cd /Users/anikkhah/Projects/clem-test/App/platforms/ios
    /Users/anikkhah/Projects/clem-test/App/platforms/ios/internal/nsld.sh -target x86_64-apple-ios12.0-simulator -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -L/Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/EagerLinkingTBDs -L/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator -F/Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/EagerLinkingTBDs -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/internal/ -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/Pods/CouchbaseLite/iOS -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/core/platforms/ios -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-barcodescanner/platforms/ios -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-sidedrawer/platforms/ios -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-core/platforms/ios -filelist /Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/App.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/App_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -sectcreate __DATA __TNSMetadata /Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/metadata-x86_64.bin -framework NativeScript -framework TKLiveSync -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/internal -licucore -lz -lc++ -framework Foundation -framework UIKit -framework CoreGraphics -framework CoreServices -framework Security -framework CouchbaseLite -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/App.app-Simulated.xcent -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __ents_der -Xlinker /Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/App.app-Simulated.xcent.der -framework TNSWidgets -framework BarcodeScannerFramework -framework TNSSideDrawer -framework TNSCore -framework Pods_App -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/App_dependency_info.dat -o /Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/App.app/App
./.build_env_vars.sh: line 492: declare: UID: readonly variable
NSLD: Swift bridging header '*-Swift.h' not found under '/Users/anikkhah/Library/Developer/Xcode/DerivedData/App-bapplmrosqyljffwkjgiexhrlvxh/Build/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64'
Generating metadata...~/Projects/clem-test/App/platforms/ios/internal/metadata-generator-x86_64/bin ~/Projects/clem-test/App/platforms/ios
Python version: 3.9.6 (default, Oct 18 2022, 12:41:40) 
[Clang 14.0.0 (clang-1400.0.29.202)]
Generating metadata for x86_64
Metadata Generator Arguments: 
./objc-metadata-generator -verbose -output-bin /Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/metadata-x86_64.bin -output-umbrella /Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/umbrella-x86_64.h -docset-path /Users/anikkhah/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset Xclang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -std=gnu99 -target x86_64-apple-ios16.2-simulator -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/include -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/internal/Swift-Modules -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/internal -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../App_Resources/iOS/src -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/camera/platforms/ios/src -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/geolocation/platforms/ios/src -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@triniwiz/nativescript-couchbase/platforms/ios/src -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-barcodescanner/platforms/ios/src -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-sidedrawer/platforms/ios/src -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-core/platforms/ios/src -I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../App_Resources/iOS/src -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/internal/ -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/Pods/CouchbaseLite/iOS -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/core/platforms/ios -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-barcodescanner/platforms/ios -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-sidedrawer/platforms/ios -F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-core/platforms/ios -DCOCOAPODS=1 -DDEBUG=1 
Clang Arguments: 
"-v", "-x", "objective-c", "-fno-objc-arc", "-fmodule-maps", "-ferror-limit=0", "-Wno-unknown-pragmas", "-Wno-ignored-attributes", "-Wno-nullability-completeness", "-Wno-expansion-to-defined", "-D__NATIVESCRIPT_METADATA_GENERATOR=1", "-isysroot", "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk", "-std=gnu99", "-target", "x86_64-apple-ios16.2-simulator", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/include", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/internal/Swift-Modules", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/internal", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../App_Resources/iOS/src", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/camera/platforms/ios/src", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/geolocation/platforms/ios/src", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@triniwiz/nativescript-couchbase/platforms/ios/src", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-barcodescanner/platforms/ios/src", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-sidedrawer/platforms/ios/src", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-core/platforms/ios/src", "-I/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../App_Resources/iOS/src", "-F/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator", "-F/Users/anikkhah/Projects/clem-test/App/platforms/ios/internal/", "-F/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator", "-F/Users/anikkhah/Projects/clem-test/App/platforms/ios/Pods/CouchbaseLite/iOS", "-F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/@nativescript/core/platforms/ios", "-F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-barcodescanner/platforms/ios", "-F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-sidedrawer/platforms/ios", "-F/Users/anikkhah/Projects/clem-test/App/platforms/ios/../../node_modules/nativescript-ui-core/platforms/ios", "-DCOCOAPODS=1", "-DDEBUG=1", 
Merged 913 categories.
Result: 53048 declarations from 176 top level modules
Done! Running time: 6.60174 sec 
Saving metadata generation's stderr stream to: /Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/metadata-generation-stderr-x86_64.txt
~/Projects/clem-test/App/platforms/ios
ld: can't write output file to '/Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/App.app/App' because that path is a directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

/Users/anikkhah/Projects/clem-test/App/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'CouchbaseLite' from project 'Pods')
/Users/anikkhah/Projects/clem-test/App/platforms/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.2.99. (in target 'Pods-App' from project 'Pods')
** BUILD FAILED **

The following build commands failed:
    Ld /Users/anikkhah/Projects/clem-test/App/platforms/ios/build/Debug-iphonesimulator/App.app/App normal (in target 'App' from project 'App')
(1 failure)
Command xcodebuild failed with exit code 65
Error: Command xcodebuild failed with exit code 65
    at Errors.failWithOptions (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:157:27)
    at Errors.fail (/usr/local/lib/node_modules/nativescript/lib/common/errors.js:130:21)
    at XcodebuildCommandService.<anonymous> (/usr/local/lib/node_modules/nativescript/lib/services/ios/xcodebuild-command-service.js:34:30)
    at Generator.throw (<anonymous>)
    at rejected (/usr/local/lib/node_modules/nativescript/lib/services/ios/xcodebuild-command-service.js:6:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Environment

OS: macOS 13.0
CPU: (4) x64 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz
Shell: /bin/zsh
node: 16.17.1
npm: 8.15.0
nativescript: 8.4.0

# android
java: javac 19
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found

# ios
xcode: 14.2/14C18
cocoapods: 1.11.3
python: 3.10.9
python3: 3.9.6
ruby: 2.6.10
platforms: 
  - DriverKit 22.2
  - iOS 16.2
  - macOS 13.1
  - tvOS 16.1
  - watchOS 9.1

Dependencies

"dependencies": {
  "@nativescript/camera": "^5.0.12",
  "@nativescript/core": "~8.4.7",
  "@nativescript/geolocation": "^8.0.2",
  "@nativescript/theme": "~3.0.1",
  "@triniwiz/nativescript-couchbase": "1.2.5",
  "moment": "^2.29.1",
  "nativescript-barcodescanner": "^4.1.2",
  "nativescript-ui-sidedrawer": "~10.0.2",
  "rxjs": "~7.5.0"
},
"devDependencies": {
  "@nativescript/android": "8.4.0",
  "@nativescript/ios": "8.4.1",
  "@nativescript/types": "~8.4.0",
  "@nativescript/webpack": "~5.0.0",
  "typescript": "~4.3.5"
}

Please accept these terms

rigor789 commented 1 year ago

Just as a sanity check, try renaming your project folder to something other than App - feel like that is conflicting with some path resolutions internally (either in our cli, or something in xcodebuild). If that fixes it, that will help narrowing down the issue further to possibly have it fixed if it's on our side.

AlirezaNikkhah1375 commented 1 year ago

Just as a sanity check, try renaming your project folder to something other than App - feel like that is conflicting with some path resolutions internally (either in our cli, or something in xcodebuild). If that fixes it, that will help narrowing down the issue further to possibly have it fixed if it's on our side.

I Will check it out as soon as possible and keep you updated.