最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Xcode9中Carthage编译Realm出错:Build Failed Task failed with exit code 65

Carthage crifan 7730浏览 0评论

折腾:

【已解决】Xcode9中报错:Module compiled with Swift 3.1 cannot be imported in Swift 3.2

期间,

➜  SRT git:(master) ✗ carthage update –platform iOS –no-use-binaries

Please update to the latest Carthage version: 0.25.0. You currently are on 0.24.0

。。。

*** Building scheme “Realm” in Realm.xcworkspace

Build Failed

    Task failed with exit code 65:

    /usr/bin/xcrun xcodebuild -workspace /Users/crifan/dev/dev_root/xxx/Carthage/Checkouts/realm-cocoa/Carthage/Realm.xcworkspace -scheme Realm -configuration Release -derivedDataPath /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build (launched in /Users/crifan/dev/dev_root/xxx/Carthage/Checkouts/realm-cocoa)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/carthage-xcodebuild.CcXf3b.log

去打开文件夹:

/var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T

<code>。。。。


CompileC /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_notifier.o Realm/ObjectStore/src/impl/collection_notifier.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/crifan/dev/dev_root/xxxxxx/Carthage/Checkouts/realm-cocoa
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++14 -stdlib=libc++ -fmodules -gmodules -fmodules-cache-path=/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -fmodule-name=Realm -fapplication-extension -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wmissing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wunknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wassign-enum -Wsign-compare -Wshorten-64-to-32 -Wnewline-eof -Wno-c++11-extensions -DREALM_HAVE_CONFIG -D__ASSERTMACROS__ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -miphoneos-version-min=8.0 -g -fvisibility-inlines-hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -fembed-bitcode -iquote /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Realm-generated-files.hmap -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Realm-own-target-headers.hmap -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Realm-all-non-framework-target-headers.hmap -ivfsoverlay /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/all-product-headers.yaml -iquote /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Realm-project-headers.hmap -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Products/Release-iphoneos/include -IRealm/ObjectStore/src -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/DerivedSources -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/DerivedSources/armv7 -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/DerivedSources -Wmismatched-tags -Wunused-private-field -F/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Products/Release-iphoneos -isystem core/include -MMD -MT dependencies -MF /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_notifier.d --serialize-diagnostics /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_notifier.dia -c /Users/crifan/dev/dev_root/xxxxxx/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/collection_notifier.cpp -o /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_notifier.o
clang: error: no such file or directory: '/Users/crifan/dev/dev_root/xxxxxx/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/collection_notifier.cpp'
clang: error: no input files

CompileC /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_change_builder.o Realm/ObjectStore/src/impl/collection_change_builder.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/crifan/dev/dev_root/xxxxxx/Carthage/Checkouts/realm-cocoa
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -arch armv7 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++14 -stdlib=libc++ -fmodules -gmodules -fmodules-cache-path=/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -fmodule-name=Realm -fapplication-extension -Wno-trigraphs -fpascal-strings -Os -fno-common -Wno-missing-field-initializers -Wmissing-prototypes -Werror=return-type -Wdocumentation -Wunreachable-code -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wunknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wassign-enum -Wsign-compare -Wshorten-64-to-32 -Wnewline-eof -Wno-c++11-extensions -DREALM_HAVE_CONFIG -D__ASSERTMACROS__ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -miphoneos-version-min=8.0 -g -fvisibility-inlines-hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -fembed-bitcode -iquote /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Realm-generated-files.hmap -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Realm-own-target-headers.hmap -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Realm-all-non-framework-target-headers.hmap -ivfsoverlay /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/all-product-headers.yaml -iquote /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Realm-project-headers.hmap -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Products/Release-iphoneos/include -IRealm/ObjectStore/src -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/DerivedSources -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/DerivedSources/armv7 -I/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/DerivedSources -Wmismatched-tags -Wunused-private-field -F/Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Products/Release-iphoneos -isystem core/include -MMD -MT dependencies -MF /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_change_builder.d --serialize-diagnostics /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_change_builder.dia -c /Users/crifan/dev/dev_root/xxxxxx/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/collection_change_builder.cpp -o /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_change_builder.o
clang: error: no such file or directory: '/Users/crifan/dev/dev_root/xxxxxx/Carthage/Checkouts/realm-cocoa/Realm/ObjectStore/src/impl/collection_change_builder.cpp'
clang: error: no input files

** BUILD FAILED **


The following build commands failed:
    CompileC /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_notifications.o Realm/ObjectStore/src/collection_notifications.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    CompileC /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_notifier.o Realm/ObjectStore/src/impl/collection_notifier.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
    CompileC /Users/crifan/Library/Caches/org.carthage.CarthageKit/DerivedData/realm-cocoa/v2.0.0/Build/Intermediates.noindex/Realm.build/Release-iphoneos/Realm.build/Objects-normal/armv7/collection_change_builder.o Realm/ObjectStore/src/impl/collection_change_builder.cpp normal armv7 c++ com.apple.compilers.llvm.clang.1_0.compiler
(3 failures)
</code>

carthage update –no-use-binaries realm xcode9 fail

XCODE9 issue carthage update –no-use-binaries –platform iOS fails · Issue #147 · thii/FontAwesome.swift

<a href="https://github.com/Carthage/Carthage/issues/1983"–<cache-builds does not work for Xcode 9 for carthage update or build · Issue #1983 · Carthage/Carthage

Error building Realm with Carthage on Swift 4 · Issue #5070 · realm/realm-cocoa

swift – Realm via Carthage for Xcode 9 Beta (9M136h) – Stack Overflow

然后才发现此处是:

github “realm/realm-cocoa” == 2.0.0

所以,去掉限制试试

估计最新版本的代码,就支持用Xcode9的编译器(此处选择的是swift 3.2)去编译了。

然后等了足够长时间,估计有半小时以上,终于编译完毕了:

期间Carthage编译也占用了大量的CPU:

导致Mac风扇狂转。。。

<code>➜  SRT git:(master) ✗ carthage update --platform iOS --no-use-binaries
Please update to the latest Carthage version: 0.25.0. You currently are on 0.24.0
*** Fetching Cartography
*** Fetching MGSwipeTableCell
*** Fetching Alamofire
*** Fetching TextFieldEffects
*** Fetching SwiftyJSON
*** Fetching KMPlaceholderTextView
*** Fetching realm-cocoa
*** Fetching SwiftHEXColors
*** Fetching SwiftHTTPStatusCodes
*** Fetching ActionSheetPicker-3.0
*** Fetching Kingfisher
*** Fetching Charts
*** Fetching SwiftKeychainWrapper
*** Fetching DLRadioButton
*** Fetching XCGLogger
*** Checking out Cartography at "1.1.0"
*** Checking out DLRadioButton at "1.4.9"
*** Checking out Charts at "v3.0.3"
*** Checking out SwiftKeychainWrapper at "2.2.1"
*** Checking out Kingfisher at "3.13.1"
*** Checking out ActionSheetPicker-3.0 at "2.2.0"
*** Checking out SwiftHTTPStatusCodes at "3.1.2"
*** Checking out SwiftHEXColors at "1.1.1"
*** Checking out realm-cocoa at "v2.10.1"
*** Checking out KMPlaceholderTextView at "1.3.0"
*** Checking out SwiftyJSON at "3.1.4"
*** Checking out TextFieldEffects at "1.3.3"
*** Checking out Alamofire at "4.5.1"
*** Checking out MGSwipeTableCell at "1.6.1"
*** Checking out XCGLogger at "Version_4.0.0"
*** xcodebuild output can be found in /var/folders/46/2hjxz38n22n3ypp_5f6_p__00000gn/T/carthage-xcodebuild.ATggqI.log
*** Building scheme "CoreActionSheetPicker" in ActionSheetPicker-3.0.xcworkspace
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
*** Building scheme "Cartography-iOS" in Cartography.xcworkspace
*** Building scheme "Charts" in Charts.xcodeproj
*** Building scheme "DLRadioButton" in DLRadioButton.xcodeproj
*** Building scheme "Kingfisher" in Kingfisher.xcworkspace
*** Building scheme "KMPlaceholderTextView" in KMPlaceholderTextView.xcodeproj
*** Building scheme "MGSwipeTableCell" in MGSwipeTableCell.xcodeproj
*** Building scheme "RealmSwift" in Realm.xcworkspace
*** Building scheme "Realm" in Realm.xcworkspace
*** Building scheme "SwiftHEXColors" in SwiftHEXColors.xcodeproj
*** Building scheme "HTTPStatusCodes" in HTTPStatusCodes.xcodeproj
*** Building scheme "SwiftKeychainWrapper" in SwiftKeychainWrapper.xcodeproj
*** Building scheme "SwiftyJSON iOS" in SwiftyJSON.xcworkspace
*** Building scheme "TextFieldEffects" in TextFieldEffects.xcodeproj
*** Building scheme "XCGLogger (iOS)" in XCGLogger.xcodeproj
</code>

【总结】

此处Xcode9中,之所以Carthage去:

<code>carthage update --platform iOS --no-use-binaries
</code>

而编译到Realm时出错,是因为之前(别的开发人员)

给Cartfile中设置了realm的版本:

<code>github "realm/realm-cocoa" == 2.0.0
</code>

而导致了没有使用最新的Realm的代码

改为:

<code>github "realm/realm-cocoa"
</code>

从而使得Carthage去下载最新的Realm的代码,然后

<code>carthage update --platform iOS --no-use-binaries
</code>

即可正常编译。

转载请注明:在路上 » 【已解决】Xcode9中Carthage编译Realm出错:Build Failed Task failed with exit code 65

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
91 queries in 0.189 seconds, using 22.07MB memory