Carthage icon indicating copy to clipboard operation
Carthage copied to clipboard

Carthage build fail in Xcode 14.3.

Open JadianZheng opened this issue 3 years ago • 13 comments

  • carthage install method: homebrew
  • which carthage: /usr/local/bin/carthage
  • carthage version: 0.39.0
  • xcodebuild -version: Xcode 14.3 Build version 14E222b
  • Are you using --no-build? NO
  • Are you using --no-use-binaries? NO
  • Are you using --use-submodules? NO
  • Are you using --cache-builds? NO
  • Are you using --new-resolver? NO
  • Are you using --use-xcframeworks? YES

Cartfile

github "SnapKit/SnapKit"
github "SnapKit/Masonry"
github "SVProgressHUD/SVProgressHUD"
github "CocoaLumberjack/CocoaLumberjack"
github "SDWebImage/SDWebImage"

github "ReactiveCocoa/ReactiveObjC"
# github "facebook/pop"
github "Alamofire/Alamofire"

Carthage Output

Build Failed
	Task failed with exit code 65:
	/usr/bin/xcrun xcodebuild -workspace /Users/jadian/Git_Project/Company/tmp_vietnam_ios/Carthage/Checkouts/Masonry/Masonry.xcworkspace -scheme Masonry\ iOS -configuration Release -derivedDataPath /Users/jadian/Library/Caches/org.carthage.CarthageKit/DerivedData/14.3_14E222b/Masonry/v1.1.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive VALIDATE_WORKSPACE=NO -archivePath /var/folders/05/cy4ywfcd4l99__z394q_cskw0000gn/T/Masonry SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /Users/jadian/Git_Project/Company/tmp_vietnam_ios/Carthage/Checkouts/Masonry)

This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/05/cy4ywfcd4l99__z394q_cskw0000gn/T/carthage-xcodebuild.0A2id9.log

Actual outcome Build fail.

Expected outcome Build success.

JadianZheng avatar Apr 01 '23 03:04 JadianZheng

+1

shin-carpediem avatar Apr 03 '23 02:04 shin-carpediem

+1

ArtsiomHainetdzinau avatar Apr 03 '23 11:04 ArtsiomHainetdzinau

+1

ValentinDenis avatar Apr 03 '23 12:04 ValentinDenis

+1

vladeku avatar Apr 04 '23 09:04 vladeku

In the meantime I just updated the workaround script for Xcode 14.3 like this:

#!/usr/bin/env bash 

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

set -euo pipefail

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

# For Xcode 14 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.

CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3)
echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1400__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig

echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1400 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1400__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $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

## optional
echo 'IPHONEOS_DEPLOYMENT_TARGET = 13.0' >> $xcconfig
echo "ENABLE_BITCODE=NO" >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"
carthage "$@"

In my case I added these lines (because I got errors about bitcode and min target iOS):

echo 'IPHONEOS_DEPLOYMENT_TARGET = 13.0' >> $xcconfig
echo "ENABLE_BITCODE=NO" >> $xcconfig

then run it with (--verbose is optional but useful to detect compilation errors and then add extra config to the workaround script):

sh carthage.sh update --platform iOS --use-xcframeworks --no-use-binaries --use-ssh --verbose

siliconsocket avatar Apr 05 '23 06:04 siliconsocket

+1

workaround script above not working either

jokjok avatar Apr 06 '23 11:04 jokjok

Found a solution.

You can check whether this applies to you by opening the library that Carthage fails to compile with Xcode and trying to build it from there. If Xcode gives you an error like "File not found: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a" you can follow the steps below to fix the issue.


By trying to compile each library directly with Xcode I found the linker was expecting to find some files in the Xcode toolchain at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc. Apparently Apple has removed the arc library altogether in Xcode 14.3.

Searching online I found this: https://stackoverflow.com/questions/75574268/missing-file-libarclite-iphoneos-a-xcode-14-3 It's about Pods so for me was sufficient to do the following:

  1. Create the missing folder cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ sudo mkdir arc

  2. Download the missing files and make them executable cd arc sudo git clone https://github.com/kamyarelyasi/Libarclite-Files.git . sudo chmod +x *

That's it, everything works, deployment on simulator, on device, archiving.

jokjok avatar Apr 08 '23 07:04 jokjok

  1. Create the missing folder
cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/
sudo mkdir arc
  1. Download the missing files and make them executable
cd arc
sudo git clone https://github.com/kamyarelyasi/Libarclite-Files.git .
sudo chmod +x *

This worked for me, thanks.

NivisUnder7 avatar Apr 14 '23 08:04 NivisUnder7

For a new iOS programmer, it is a disaster compared to android, because it's development environment like shit

DeveloperLinus avatar Apr 26 '23 07:04 DeveloperLinus

Adding files to Xcode.app every time Xcode is upgraded is troublesome. Could you make it possible to set IPHONEOS_DEPLOYMENT_TARGET like CocoaPods?

jmotoyama avatar Apr 28 '23 07:04 jmotoyama

I used solution based on https://github.com/Carthage/Carthage/issues/3333#issuecomment-1496995199 for solving same issue:

ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 11.0 to 16.4.99. (in target 'DeviceKit' from project 'Pods')
** ARCHIVE FAILED **

Overriding works well for xcode 14.3.1 (requires 11.0):

#!/usr/bin/env bash 

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

set -euo pipefail

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

## optional
echo 'IPHONEOS_DEPLOYMENT_TARGET = 11.0' >> $xcconfig
echo "ENABLE_BITCODE=NO" >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"
carthage "$@"

kreshikhin avatar Jun 24 '23 22:06 kreshikhin

Adding files to Xcode.app every time Xcode is upgraded is troublesome. Could you make it possible to set IPHONEOS_DEPLOYMENT_TARGET like CocoaPods?

the solution is to move to SPM as soon as possible for everything you use.

aehlke avatar Jul 14 '23 21:07 aehlke

Found a solution.

You can check whether this applies to you by opening the library that Carthage fails to compile with Xcode and trying to build it from there. If Xcode gives you an error like "File not found: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a" you can follow the steps below to fix the issue.

By trying to compile each library directly with Xcode I found the linker was expecting to find some files in the Xcode toolchain at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc. Apparently Apple has removed the arc library altogether in Xcode 14.3.

Searching online I found this: https://stackoverflow.com/questions/75574268/missing-file-libarclite-iphoneos-a-xcode-14-3 It's about Pods so for me was sufficient to do the following:

  1. Create the missing folder cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/ sudo mkdir arc
  2. Download the missing files and make them executable cd arc sudo git clone https://github.com/kamyarelyasi/Libarclite-Files.git . sudo chmod +x *

That's it, everything works, deployment on simulator, on device, archiving.

Worked for me. Thanks

trantuananh1996 avatar Dec 16 '23 10:12 trantuananh1996