简体   繁体   中英

NativeScript iOS Build Fails Xcode - Error: Command Ld failed with a nonzero exit code

I've wasted a ton of time trying to build a NativeScript project for iOS. I've been developing a mobile NativeScript app for a while now but since I primarily use Windows I've only been able to test on Android until now. I finally got my Macbook out to try my NativeScript Angular app on an iOS device but I've had nothing but trouble.

I even tried starting a brand new helloworld project ns create myapptest and ns run ios --no-hmr I still get a failed build and the error reporting is not really helping. I've searched and tried so many things with no luck. Everything is updated to latest versions. The Cli shows error Command xcodebuild failed with exit code 65. and Xcode 12 shows Command Ld failed with a nonzero exit code neither of which have been too helpful but it appears something goes wrong during the linking phase. I even tried Xcode 11.7 and Xcode 12.3-Beta and still get the same errors. I pasted the error output from Xcode 12 below and here is a pastebin link https://pastebin.com/Y2RpAmTE with the full log trace of ns build ios --release --log trace .

Oddly enough, I did get one project to run on an iOS device. It's a demo of the nativescript-barcodescanner from @EddyVerbruggen https://github.com/eddyverbruggen/nativescript-barcodescanner I was able to open the Xcode project file up and build/run it on a physical iOS device. I can't find the difference between that demo project and a fresh HelloWorld project from the CLi.

Can anyone please help? Thank you for your time, I really appreciate it!

To Reproduce: ns create myapptest && ns run ios --no-hmr

Expected behavior: App to build successfully for iOS Device and Simulator

Sample project: Default NativeScript Cli HelloWorld Project

Error Output From Xcode:

Showing All Messages
Ld /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/myapptest.app/myapptest normal (in target 'myapptest' from project 'myapptest')
    cd /Users/rob/Documents/ns/myapptest/platforms/ios
    /Users/rob/Documents/ns/myapptest/platforms/ios/internal/nsld.sh -target arm64-apple-ios9.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -L/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/ -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents -F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios -filelist /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Intermediates.noindex/myapptest.build/Debug-iphoneos/myapptest.build/Objects-normal/arm64/myapptest.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/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Intermediates.noindex/myapptest.build/Debug-iphoneos/myapptest.build/Objects-normal/arm64/myapptest_lto.o -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -ObjC -sectcreate __DATA __TNSMetadata /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/metadata-arm64.bin -framework NativeScript -framework TKLiveSync -F/Users/rob/Documents/ns/myapptest/platforms/ios/internal -licucore -lz -lc++ -framework Foundation -framework UIKit -framework CoreGraphics -framework MobileCoreServices -framework Security -framework MDFInternationalization -framework MaterialComponents -framework TNSWidgets -framework Pods_myapptest -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Intermediates.noindex/myapptest.build/Debug-iphoneos/myapptest.build/Objects-normal/arm64/myapptest_dependency_info.dat -o /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/myapptest.app/myapptest

./.build_env_vars.sh: line 445: declare: UID: readonly variable
NSLD: Swift bridging header '*-Swift.h' not found under '/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Intermediates.noindex/myapptest.build/Debug-iphoneos/myapptest.build/Objects-normal/arm64'
Generating metadata...~/Documents/ns/myapptest/platforms/ios/internal/metadata-generator/bin ~/Documents/ns/myapptest/platforms/ios
Python version: 2.7.16 (default, Jun  5 2020, 22:59:21) 
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc-
Generating metadata for arm64
Metadata Generator Arguments: 
./objc-metadata-generator -verbose -output-bin /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/metadata-arm64.bin -output-umbrella /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/umbrella-arm64.h -docset-path /Users/rob/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset Xclang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -miphoneos-version-min=9.0 -std=gnu99 -target arm64-apple-ios13.0-macabi -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers -I/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules -I/Users/rob/Documents/ns/myapptest/platforms/ios/internal -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/ -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents -F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/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/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk", "-miphoneos-version-min=9.0", "-std=gnu99", "-target", "arm64-apple-ios13.0-macabi", "-I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include", "-I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers", "-I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/internal", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src", "-I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src", "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos", "-F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/", "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos", "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization", "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents", "-F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios", "-DCOCOAPODS=1", "-DDEBUG=1", 
Saving metadata generation's stderr stream to: /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/metadata-generation-stderr-arm64.txt
Error: Unable to generate metadata for arm64.
Metadata Generator Arguments: 
./objc-metadata-generator -verbose -output-bin /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/metadata-arm64.bin -output-umbrella /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/umbrella-arm64.h -docset-path /Users/rob/Library/Developer/Shared/Documentation/DocSets/com.apple.adc.documentation.iOS.docset Xclang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk -miphoneos-version-min=9.0 -std=gnu99 -target arm64-apple-ios13.0-macabi -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers -I/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers -I/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules -I/Users/rob/Documents/ns/myapptest/platforms/ios/internal -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src -I/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/ -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization -F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents -F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios -DCOCOAPODS=1 -DDEBUG=1 
clang version 8.0.1 (tags/RELEASE_801/final)
Target: arm64-apple-ios13.0-macabi
Thread model: posix
InstalledDir: 
warning: overriding '-miphoneos-version-min=9.0' option with '--target=arm64-apple-ios13.0-macabi' [-Woverriding-t-option]
clang Invocation:
 "clang-tool" "-cc1" "-triple" "arm64-apple-ios13.0.0-macabi" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "umbrella.h" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-sdk-version=14.2" "-target-cpu" "cyclone" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+sha2" "-target-feature" "+aes" "-target-abi" "darwinpcs" "-fallow-half-arguments-and-returns" "-dwarf-column-info" "-debugger-tuning=lldb" "-ggnu-pubnames" "-target-linker-version" "556.6" "-v" "-resource-dir" "lib/clang/8.0.1" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk" "-D" "__NATIVESCRIPT_METADATA_GENERATOR=1" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos" "-F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents" "-F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios" "-D" "COCOAPODS=1" "-D" "DEBUG=1" "-Wno-unknown-pragmas" "-Wno-ignored-attributes" "-Wno-nullability-completeness" "-Wno-expansion-to-defined" "-std=gnu99" "-fdebug-compilation-dir" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/metadata-generator/bin" "-ferror-limit" "0" "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fimplicit-module-maps" "-fregister-global-dtors-with-atexit" "-fobjc-runtime=ios-13.0.0" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" "-x" "objective-c" "umbrella.h"

ignoring nonexistent directory "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/Library/Frameworks"
ignoring duplicate directory "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos"
#include "..." search starts here:
#include <...> search starts here:
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers
 /Users/rob/Documents/ns/myapptest/platforms/ios/internal
 /Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos (framework directory)
 /Users/rob/Documents/ns/myapptest/platforms/ios/internal (framework directory)
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization (framework directory)
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents (framework directory)
 /Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios (framework directory)
 lib/clang/8.0.1/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/System/Library/Frameworks (framework directory)
End of search list.
clang version 8.0.1 (tags/RELEASE_801/final)
Target: arm64-apple-ios13.0-macabi
Thread model: posix
InstalledDir: 
warning: overriding '-miphoneos-version-min=9.0' option with '--target=arm64-apple-ios13.0-macabi' [-Woverriding-t-option]
clang Invocation:
 "objc-metadata-generator" "-cc1" "-triple" "arm64-apple-ios13.0.0-macabi" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-fsyntax-only" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "umbrella.h" "-mrelocation-model" "pic" "-pic-level" "2" "-mthread-model" "posix" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-sdk-version=14.2" "-target-cpu" "cyclone" "-target-feature" "+fp-armv8" "-target-feature" "+neon" "-target-feature" "+crypto" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-feature" "+sha2" "-target-feature" "+aes" "-target-abi" "darwinpcs" "-fallow-half-arguments-and-returns" "-dwarf-column-info" "-debugger-tuning=lldb" "-ggnu-pubnames" "-target-linker-version" "556.6" "-v" "-resource-dir" "lib/clang/8.0.1" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/dispatch" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/libxml" "-idirafter" "lib/clang/8.0.1/include" "-idirafter" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/mach-o" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/unicode" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/objc" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/simd" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/CommonCrypto" "-idirafter" "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/AppleArchive" "-D" "__NATIVESCRIPT_METADATA_GENERATOR=1" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers" "-I" "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src" "-I" "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos" "-F/Users/rob/Documents/ns/myapptest/platforms/ios/internal/" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization" "-F/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents" "-F/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios" "-D" "COCOAPODS=1" "-D" "DEBUG=1" "-Wno-unknown-pragmas" "-Wno-ignored-attributes" "-Wno-nullability-completeness" "-Wno-expansion-to-defined" "-std=gnu99" "-fdebug-compilation-dir" "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/metadata-generator/bin" "-ferror-limit" "0" "-fmessage-length" "0" "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fimplicit-module-maps" "-fregister-global-dtors-with-atexit" "-fobjc-runtime=ios-13.0.0" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option" "-x" "objective-c" "umbrella.h"

clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target x86_64-apple-darwin19.6.0
ignoring nonexistent directory "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/include"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/internal/Swift-Modules"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src"
ignoring nonexistent directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../App_Resources/iOS/src"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/Library/Frameworks"
ignoring duplicate directory "/Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos"
ignoring duplicate directory "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include"
ignoring duplicate directory "lib/clang/8.0.1/include"
ignoring duplicate directory "/Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization/MDFInternationalization.framework/Headers
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents/MaterialComponents.framework/Headers
 /Users/rob/Documents/ns/myapptest/platforms/ios/internal
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos (framework directory)
 /Users/rob/Documents/ns/myapptest/platforms/ios/internal (framework directory)
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MDFInternationalization (framework directory)
 /Users/rob/Library/Developer/Xcode/DerivedData/myapptest-clnrwihkairvvaadozxrenxvmhsz/Build/Products/Debug-iphoneos/MaterialComponents (framework directory)
 /Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios (framework directory)
 lib/clang/8.0.1/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/System/Library/Frameworks (framework directory)
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/dispatch
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/libxml
 /Users/rob/Documents/ns/myapptest/platforms/ios/../../node_modules/@nativescript/core/platforms/ios/src
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/mach-o
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/unicode
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/objc
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/simd
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/CommonCrypto
 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.2.sdk/usr/include/AppleArchive
End of search list.

Command Ld failed with a nonzero exit code

Also, please see full log trace of ns build ios --release --log trace at pastebin link: https://pastebin.com/Y2RpAmTE

I finally figured it out! I think it has something to do with using a Mac that is patched with dosdude1 patcher to run macOS Catalina on an unsupported mac. The way I got it to work was compiling the metadate generator myself by:

  • Download LLVM 8.0 http://releases.llvm.org/download.html#8.0.0 (direct download: https://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz ) And be sure to have the folder containing llvm-config in PATH or make a symlink to in /usr/local/bin/
  • Download and install Cmake https://cmake.org/download/ (NOTE: If you are using dosdude1's patch to run macOS Catalina DO NOT use homebrew to install LLVM and Cmake, I've had trouble with homebrew installing software with uncompatible binaries which gives errors like zsh: illegal hardware instruction so be safe and use the above links to download.)
  • git clone https://github.com/NativeScript/ns-v8ios-runtime
  • cd ns-v8ios-runtime
  • ./build_metadata_generator.sh This will build objc-metadata-generator in ns-v8ios-runtime/metadata-generator/bin You will need to copy and paste this entire bin folder in the next steps .
  • Now go to your NativeScript project directory (I will call it demo-app ) cd demo-app
  • If you haven't already, prepare the project for iOS ns prepare ios
  • Now you are going to replace the non-working objc-metadata-generator with the one we just compiled a few steps ago. First we will delete the existing bin folder and then copy our newly complied bin folder in its place. rm -R platforms/ios/internal/metadata-generator/bin
  • Now copy the bin folder we compiled from ns-v8ios-runtime/metadata-generator/bin and past it into you project, demo-app/platforms/ios/internal/metadata-generator/bin
  • ns run ios --no-hmr

Your project should work on iOS now! Hopefully this helps someone, it worked for me. Please note though that any time you ns platform remove ios you will need to replace the bin folder in your project with the one you compiled yourself. Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM