Xcode12でcarthage updateに対応:This usually indicates that project itself failed to compileというエラーになった時の対処方法

2020年11月26日

Xcode12でcarthage updateをすると「This usually indicates that project itself failed to compile」というエラーになります。

Build Failed
Task failed with exit code 1:
/usr/bin/xcrun lipo -create /Users//Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/sdk-v2-ios/2.0.1/Build/Intermediates.noindex/ArchiveIntermediates/Test\ iOS/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Test.framework/Test /Users//Library/Caches/org.carthage.CarthageKit/DerivedData/12.2_12B45b/sdk-v2-ios/2.0.1/Build/Products/Release-iphonesimulator/Test.framework/Test -output /Users/***/Desktop/Product/Carthage/Build/iOS/Test.framework/Test

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/xy/_ss8dbhd19v8ly9qqqfty7y80000gn/T/carthage-xcodebuild.7GL8Vq.log

今回はこのエラーが出た時の対処方法をご紹介します。

This usually indicates that project itself failed to compileというエラーになった時の対処方法

carthage.xcconfigを作成しプロジェクト内に配置する

carthage.xcconfigを作成しましょう。

プロジェクト内のAppDelegate.hや.mと同じ階層に作成してしまって大丈夫です。

EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))

作成したファイルの中には上記を記述します。

carthage.xcconfigを適応させる

export XCODE_XCCONFIG_FILE=/Users/~~~~/carthage.xcconfig

「export XCODE_XCCONFIG_FILE=」で先ほどのcarthage.xcconfigを適応させます。

carthage updateする

carthage update

最後にいつものように「carthage update」でアップデートします。

これで正常にライブラリをアップデートすることができます。

一度アップデートすると再度「export XCODE_XCCONFIG_FILE=」でcarthage.xcconfigを適応させる必要があります。

面倒ですがcarthageの公式がXcode12に対応するまで上記で対応しましょう。