Rightpoint / Anchorage

A collection of operators and utilities that simplify iOS layout code.
MIT License
627 stars 46 forks source link

Carthage problems on Xcode 12 #92

Open brettambrosestuart opened 3 years ago

brettambrosestuart commented 3 years ago

I'm having a problem using Anchorage with XCode 12 and iOS 14. Running on a simulator I get - (if using command line tools 11.7 for Carthage) "Building for iOS Simulator, but the linked framework 'Anchorage.framework' was built for iOS."

If I use command line tools 12 for Carthage build fails ("Task failed with exit code 1: ,, This usually indicates that project itself failed to compile."). I checked the xcode logs and they succeeded but with many warnings - "*.pcm: No such file or directory." If anyone one has any ideas or need more info to investigate that would be great.

My biggest question though is if Anchorage is still supported and if this issue is on my side or should I wait for a fix? I was also thinking of pulling the Anchorage source, try fix myself and add the framework in the project, but I don't know if that's a good idea?

Any help would be great.

ZevEisenberg commented 3 years ago

Hi, Brett. I believe Anchorage is still supported. Unfortunately, Carthage is having some issues with Xcode 12, and that may be what you're running into. Check out this issue on one of Rightpoint's other repos and let me know if that answers your questions: https://github.com/Rightpoint/BonMot/issues/394

chrisballinger commented 3 years ago

That is correct, Carthage is the problem here, and will be until they adopt xcframework support. Recommended workaround solution is using CocoaPods, Swift Package Manager, or integrating manually.

brettambrosestuart commented 3 years ago

Ok, thanks for the heads-up, much appreciated. It is a bit of an older project and CocoaPods weren't used, so I started looking at manual integration here. Thanks again.

tangzzz-fan commented 2 months ago

You can use script like this when you use Carthage

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_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

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