Carthage build failed Xcode 12 12A7209 building

半城伤御伤魂 提交于 2021-01-13 08:53:51

问题


Carthage File contents:

github "SwiftyJSON/SwiftyJSON"

Error:

Build Failed
Task failed with exit code 1:
/usr/bin/xcrun lipo -create /Users/samrezikram/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A7209/SwiftyJSON/5.0.0/Build/Intermediates.noindex/ArchiveIntermediates/SwiftyJSON\ tvOS/IntermediateBuildFilesPath/UninstalledProducts/appletvos/SwiftyJSON.framework/SwiftyJSON /Users/samrezikram/Library/Caches/org.carthage.CarthageKit/DerivedData/12.0_12A7209/SwiftyJSON/5.0.0/Build/Products/Release-appletvsimulator/SwiftyJSON.framework/SwiftyJSON -output /Users/samrezikram/Downloads/CarthageApp/Carthage/Build/tvOS/SwiftyJSON.framework/SwiftyJSON

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/px/jx4gljpj47j06qr7blw6b4w80000gn/T/carthage-xcodebuild.1NVy7o.log

回答1:


This is a Carthage & Xcode 12 issue. Unfortunately at the moment there is no update from the Carthage team to address this issue. However, there is a shell script you can run to unblock you. It has worked for me. You can follow the thread on the Carthage github account. https://github.com/Carthage/Carthage/issues/3019#issuecomment-665136323

  1. Create a shell script carthage-build.sh and place it in your Xcode project
#!/usr/bin/env bash

# carthage.sh
# Usage example: ./carthage-build.sh build --platform iOS

set -euo pipefail

xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT

# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' >> $xcconfig
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"
carthage "$@"
  1. Run the script from your terminal to update your Carthage frameworks
$ ./carthage-build.sh build --platform iOS

Your frameworks should be able to update and compile.

FYI - I did not write this script, the credit goes to https://github.com/rastersize

Please follow the thread here for updates on this issue. https://github.com/Carthage/Carthage/issues/3019




回答2:


to avoid /usr/bin/xcrun lipo -create issue while updating the Carthage, we have to modify the workspace configuration.

  • Open Terminal and navigate to workspace directory.

Xcode 12.0

  • run curl https://gist.githubusercontent.com/skymobilebuilds/61f4a95bd62a3db36b52719aeab7e0d5/raw/4ba422e5f3a5e7e37cdcb1e232058c5431fc59fc/carthage-xc12.sh -o wcarthage && chmod +x wcarthage

Xcode 12.0.1

  • run curl https://gist.githubusercontent.com/skymobilebuilds/61f4a95bd62a3db36b52719aeab7e0d5/raw/f638b57097897b38fc0b1e62a527a814952968d7/carthage-xc12.sh -o wcarthage && chmod +x wcarthage

Xcode 12.2

use this script in wcarthage file.

#!/bin/sh -e
echo "Carthage wrapper"
echo "Applying Xcode 12 workaround..."
xcconfig="/tmp/xc12-carthage.xcconfig"

# Xcode 12.x
echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = arm64 arm64e armv7 armv7s armv6 armv8' > $xcconfig

# General stuff
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
echo 'ONLY_ACTIVE_ARCH=NO' >> $xcconfig
echo 'VALID_ARCHS = $(inherited) x86_64' >> $xcconfig
export XCODE_XCCONFIG_FILE="$xcconfig"
echo "Workaround applied. xcconfig here: $XCODE_XCCONFIG_FILE"

carthage $@
  • After completing wcarthage download, run any one of the following commands based on the requirement.

    ./wcarthage update --platform iOS --cache-builds or ./wcarthage bootstrap --platform iOS --cache-builds

I found this fix at skymobilebuilds



来源:https://stackoverflow.com/questions/63978083/carthage-build-failed-xcode-12-12a7209-building

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!