Carthage: "Building universal frameworks with common architectures is not possible." error

Created on 12 Mar 2021  ·  14Comments  ·  Source: Carthage/Carthage

  • carthage install method: [ ] .pkg, [x] homebrew, [ ] source
  • which carthage: /usr/local/bin/carthage
  • carthage version: 0.37.0
  • xcodebuild -version: Xcode 12.4

I've added SPM support to my library, PocketSVG, but for some reason that has broken the pre-existing Carthage support.

This is what happens when I run carthage build --no-skip-current in my library's root dir:

*** xcodebuild output can be found in /var/folders/13/jh62fb214m394xbztdjkl2vm0000gn/T/carthage-xcodebuild.tIYkoX.log
*** Building scheme "PocketSVG-Package" in PocketSVG.xcodeproj
A shell task (/usr/bin/xcrun lipo -create /Users/arielelkin/Library/Developer/Xcode/DerivedData/PocketSVG-dzlvljxmlvgxeleefahougoqtbux/Build/Intermediates.noindex/ArchiveIntermediates/PocketSVG-Package/IntermediateBuildFilesPath/UninstalledProducts/appletvos/PocketSVG.framework/PocketSVG /Users/arielelkin/Library/Developer/Xcode/DerivedData/PocketSVG-dzlvljxmlvgxeleefahougoqtbux/Build/Products/Release-appletvsimulator/PocketSVG.framework/PocketSVG -output /Users/arielelkin/PocketSVG/Carthage/Build/tvOS/PocketSVG.framework/PocketSVG) failed with exit code 1:
fatal error: /Applications/Xcode_12.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /Users/arielelkin/Library/Developer/Xcode/DerivedData/PocketSVG-dzlvljxmlvgxeleefahougoqtbux/Build/Intermediates.noindex/ArchiveIntermediates/PocketSVG-Package/IntermediateBuildFilesPath/UninstalledProducts/appletvos/PocketSVG.framework/PocketSVG and /Users/arielelkin/Library/Developer/Xcode/DerivedData/PocketSVG-dzlvljxmlvgxeleefahougoqtbux/Build/Products/Release-appletvsimulator/PocketSVG.framework/PocketSVG have the same architectures (arm64) and can't be in the same fat output file

Building universal frameworks with common architectures is not possible. The device and simulator slices for "PocketSVG" both build for: arm64
Rebuild with --use-xcframeworks to create an xcframework bundle instead.

Most helpful comment

The above is working with xcode 12.x. Just tried with XC13 beta on macOS 12 Monterey Beta:

Xcode 13.0
Build version 13A5154h
xcode-select version 2388. installed in /Applications/Xcode-beta.app/Contents/Developer
swift-driver version: 1.26 Apple Swift version 5.5 (swiftlang-1300.0.19.104 clang-1300.0.18.4)
Target: x86_64-apple-macosx12.0

and it does not work anymore, giving lipo errors.

I tried adding also this to the temporary xcconfig but with no luck:

EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300__BUILD_13A5154h = arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))

not sure if the needed variable name still follows previously known patterns:

  • EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300
  • EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300__BUILD_13A5154h

Has anyone tried this?

All 14 comments

Can you clear DerivedData and try again?

Hi @tmspzz

The issue is still there after clearing DerivedData.

You can reproduce it by cloning the library:
https://github.com/pocketsvg/pocketsvg

and running carthage build --no-skip-current

Hi @tmspzz Any updates? Were you able to reproduce the issue?

@arielelkin No sorry, I'm not currently looking into this

I'm also encountering this while trying to build an existing project using Alamofire 5.4.1:

$ carthage build --platform iOS
*** xcodebuild output can be found in /var/folders/j3/7pf540td3xncn7jdqtb62_ph00058y/T/carthage-xcodebuild.4j9gJ4.log
*** Building scheme "Alamofire iOS" in Alamofire.xcworkspace
A shell task (/usr/bin/xcrun lipo -create /Users/callen/Library/Caches/org.carthage.CarthageKit/DerivedData/12.4_12D4e/Alamofire/4.8.1/Build/Intermediates.noindex/ArchiveIntermediates/Alamofire\ iOS/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework/Alamofire /Users/callen/Library/Caches/org.carthage.CarthageKit/DerivedData/12.4_12D4e/Alamofire/4.8.1/Build/Products/Release-iphonesimulator/Alamofire.framework/Alamofire -output /Users/callen/Projects/port80/archives-library-kiosk-app/Carthage/Build/iOS/Alamofire.framework/Alamofire) failed with exit code 1:
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /Users/callen/Library/Caches/org.carthage.CarthageKit/DerivedData/12.4_12D4e/Alamofire/4.8.1/Build/Intermediates.noindex/ArchiveIntermediates/Alamofire iOS/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Alamofire.framework/Alamofire and /Users/callen/Library/Caches/org.carthage.CarthageKit/DerivedData/12.4_12D4e/Alamofire/4.8.1/Build/Products/Release-iphonesimulator/Alamofire.framework/Alamofire have the same architectures (arm64) and can't be in the same fat output file

Building universal frameworks with common architectures is not possible. The device and simulator slices for "Alamofire" both build for: arm64
Rebuild with --use-xcframeworks to create an xcframework bundle instead.

carthage 0.37.0
macOS 10.15.7
Xcode 12.4
Intel Mac

Hey @arielelkin. I've encountered a similar problem and it is not the perfect solution, but you can use the same workaround as described here https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md to fix this problem. Cheers

I have the same issue:

carthage 0.37.0
macOS Big Sur
Xcode 12.4
Mac M1

Does it not work at all with Apple Silicon?

I have the same problem with Tesseract-OCR-iOS.

Carthage 0.37.0
macOS Big Sure
Xcode 12.4
Mac M1

Using this script worked for me (I was using it for the original issue, tried to build without it and got this problem; went back to the script and everything worked 🤷🏻‍♂️).

@dbmrq Do you have a Mac M1?

@dbmrq Do you have a Mac M1?

Nope!

And I just found out that while Carthage compiles the frameworks using the script I mentioned, the resulting frameworks do not work on the project with the latest version of Xcode! :(

Same problem trying to build Alamofire.

./carthage.sh update --platform "iOS"      

carthage.sh:

# 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 12 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_1200__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_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__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

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

The above is working with xcode 12.x. Just tried with XC13 beta on macOS 12 Monterey Beta:

Xcode 13.0
Build version 13A5154h
xcode-select version 2388. installed in /Applications/Xcode-beta.app/Contents/Developer
swift-driver version: 1.26 Apple Swift version 5.5 (swiftlang-1300.0.19.104 clang-1300.0.18.4)
Target: x86_64-apple-macosx12.0

and it does not work anymore, giving lipo errors.

I tried adding also this to the temporary xcconfig but with no luck:

EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300__BUILD_13A5154h = arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))

not sure if the needed variable name still follows previously known patterns:

  • EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300
  • EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1300__BUILD_13A5154h

Has anyone tried this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rogernolan picture rogernolan  ·  3Comments

itinance picture itinance  ·  3Comments

abbeyjackson picture abbeyjackson  ·  3Comments

yonaskolb picture yonaskolb  ·  3Comments

pmhood picture pmhood  ·  3Comments