Carthage: Unsupported Architecture Errors While Uploading to iTunes Connect

Created on 8 Mar 2018  Â·  29Comments  Â·  Source: Carthage/Carthage

  • carthage install method: [ ] .pkg, [ *] homebrew, [ ] source
  • carthage version: 0.28.0
  • xcodebuild -version: Xcode 9.2 Build version 9C40b

Cartfile

github "facebook/Facebook-SDK-Swift"
github "JohnSundell/Wrap"
github "Alamofire/Alamofire" ~> 4.7
github "evgenyneu/Cosmos" ~> 15.0
github "rs/SDWebImage"
github "gilesvangruisen/Swift-YouTube-Player"
github "PureLayout/PureLayout"

I'm getting invalid architecture error while uploading to the App Store. I have set Enable Code Coverage Support to No.

I have tried using copy-frameworks and this script I found on SO to fix the issue, but both haven't worked for me.

echo "Target architectures: $ARCHS"

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

FRAMEWORK_TMP_PATH="$FRAMEWORK_EXECUTABLE_PATH-tmp"

# remove simulator's archs if location is not simulator's directory
case "${TARGET_BUILD_DIR}" in
*"iphonesimulator")
echo "No need to remove archs"
;;
*)
if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "i386") ; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "i386" "$FRAMEWORK_EXECUTABLE_PATH"
echo "i386 architecture removed"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
if $(lipo "$FRAMEWORK_EXECUTABLE_PATH" -verify_arch "x86_64") ; then
lipo -output "$FRAMEWORK_TMP_PATH" -remove "x86_64" "$FRAMEWORK_EXECUTABLE_PATH"
echo "x86_64 architecture removed"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_TMP_PATH" "$FRAMEWORK_EXECUTABLE_PATH"
fi
;;
esac

echo "Completed for executable $FRAMEWORK_EXECUTABLE_PATH"
echo $(lipo -info "$FRAMEWORK_EXECUTABLE_PATH")

done

I also checked the frameworks after archiving my project using lipo but I saw that the unsupported architectures were still in there.

question

Most helpful comment

Your issue is that you have an _Embed Frameworks_ build phase. That does the work that copy-frameworks does, but doesn't strip the unused architectures. Remove that build phase and you should be good to go.

All 29 comments

I have tried using copy-frameworks and this script I found on SO to fix the issue, but both haven't worked for me.

What do you mean copy-frameworks hasn't worked?

Can you share the full error you get from iTunes Connect?

Can you specify if you are using one of bootstrap , update or build ?

@mdiep I get these errors and warnings for each of the frameworks:

screen shot 2018-03-08 at 7 03 28 am
screen shot 2018-03-08 at 7 03 49 am
screen shot 2018-03-08 at 7 04 00 am
screen shot 2018-03-08 at 7 04 19 am

@blender to be precise I used:
carthage update --platform iOS

copy-frameworks should be stripping the simulator slices for you. Are you sure you're using it correctly? Can you share a screenshot of your build phases?

@mdiep I followed the steps listed in the readme

screen shot 2018-03-08 at 7 29 26 am

can you please run:

  • which lipo
  • lipo
  • xcode-select -p

which lipo:

/usr/bin/lipo

lipo:

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: one of -create, -thin <arch_type>, -extract <arch_type>, -remove <arch_type>, -replace <arch_type> <file_name>, -verify_arch <arch_type> ... , -info or -detailed_info must be specified
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo [input_file] ... [-arch <arch_type> input_file] ... [-info] [-detailed_info] [-output output_file] [-create] [-arch_blank <arch_type>] [-thin <arch_type>] [-remove <arch_type>] ... [-extract <arch_type>] ... [-extract_family <arch_type>] ... [-verify_arch <arch_type> ...] [-replace <arch_type> <file_name>] ...

xcode-select -p

/Applications/Xcode.app/Contents/Developer

please run

  • brew info carthage
  • ls -la `which carthage` Edit: Added -la

brew info carthage:

carthage: stable 0.28.0 (bottled), HEAD
Decentralized dependency manager for Cocoa
https://github.com/Carthage/Carthage
/usr/local/Cellar/carthage/0.25.0 (75 files, 25.8MB)
  Poured from bottle on 2017-10-05 at 22:17:47
/usr/local/Cellar/carthage/0.26.2 (75 files, 25.9MB)
  Poured from bottle on 2017-10-22 at 10:45:26
/usr/local/Cellar/carthage/0.27.0 (69 files, 26.6MB)
  Poured from bottle on 2018-01-24 at 14:53:29
/usr/local/Cellar/carthage/0.28.0 (69 files, 26.7MB) *
  Poured from bottle on 2018-03-05 at 21:38:27
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/carthage.rb
==> Requirements
Build: xcode ✔
==> Options
--HEAD
    Install HEAD version
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

zsh completions have been installed to:
  /usr/local/share/zsh/site-functions

ls which carthage:

/usr/local/bin/carthage

@siddarthgandhi sorry it needs to be ls -la `which carthage`

@blender here you go:

lrwxr-xr-x 1 siddarth admin 38 Mar 5 21:38 /usr/local/bin/carthage -> ../Cellar/carthage/0.28.0/bin/carthage

everything seems in order here however it seems that your lipo is broken somehow. Can you run on one of the frameworks in the app .ipa

lipo <your_framework_from_the_ipa> -remove x86_64 -output <some_name_for_output>
lipo -info  <some_name_for_output>

Yep that worked just fine:

Architectures in the fat file: new.framework are: i386 armv7 arm64

try

xcrun lipo <your_framework_from_the_ipa> -remove x86_64 -output <some_name_for_output>
xcrun lipo -info  <some_name_for_output>

Same result

Architectures in the fat file: new.framework are: i386 armv7 arm64

please run

  • brew switch carthage <pick-a-version-that-is-not-28>
  • brew info carthage (confirm this version is the one with the *)

archive again & lipo info

Tried with 0.27.0 and 0.26.2 but all the architectures are still in there.

Architectures in the fat file: Alamofire.framework/Alamofire are: i386 x86_64 armv7 arm64

I'm very very confused, either noone has submitted a binary to the appstore with carthage since a looong time or (most probably) there is some weird issue with either your dependencies or your setup (which I tried to diagnose)

Damn. I tried removing every trace of carthage from the project and re-doing it but it didn't work. Whats weird is it worked the first time (just the one time) but started throwing those errors again.

just try with __JUST__ alamofire in your cartfile, make carthage build only almofire and archive. Then check alamofire with lipo.

If this gives the correct output then there is problem with the dep chain that you have that is tripping copy-frameworks

I created a new project. Added just Alamofire. Same output:

Architectures in the fat file: Alamofire.framework/Alamofire are: i386 x86_64 armv7 arm64

I would argue it's something in your setup that I'm unable to diagnose at this point :\

Can you share a sample project that exhibits the issue?

@mdiep here you go

CarthageTest.zip

Your issue is that you have an _Embed Frameworks_ build phase. That does the work that copy-frameworks does, but doesn't strip the unused architectures. Remove that build phase and you should be good to go.

@siddarthgandhi please consider closing the issue if the problem is resolved

Oh my god thank you so much!

I ran into this as well. Maybe newer versions of xcode add this step automatically? If so, might be worth updating the readme to reflect the additional step of needing to delete the "Embed Frameworks" run phase.

I ran into this as well. Maybe newer versions of xcode add this step automatically? If so, might be worth updating the readme to reflect the additional step of needing to delete the "Embed Frameworks" run phase.

Same issue here, happened to me after adding a new library in Xcode 11 where the default seems to be "Embed and Sign" instead of "Do not embed". This is probably worth pinning.

Was this page helpful?
0 / 5 - 0 ratings