Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carthage build fail in Xcode 14.3. #3333

Open
JadianZheng opened this issue Apr 1, 2023 · 13 comments
Open

Carthage build fail in Xcode 14.3. #3333

JadianZheng opened this issue Apr 1, 2023 · 13 comments

Comments

@JadianZheng
Copy link

  • 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.

@shin-carpediem
Copy link

+1

3 similar comments
@ArtsiomHainetdzinau
Copy link

+1

@ValentinDenis
Copy link

+1

@vladeku
Copy link

vladeku commented Apr 4, 2023

+1

@siliconsocket
Copy link

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

@jokjok
Copy link

jokjok commented Apr 6, 2023

+1

workaround script above not working either

@jokjok
Copy link

jokjok commented Apr 8, 2023

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.

@NivisUnder7
Copy link

  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.

@DeveloperLinus
Copy link

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

@jmotoyama
Copy link

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

@kreshikhin
Copy link

I used solution based on #3333 (comment) 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 "$@"

@aehlke
Copy link

aehlke commented Jul 14, 2023

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.

@trantuananh1996
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

14 participants