Skip to content

Commit

Permalink
fix undefined_arch error in Xcode 10 beta (#19841)
Browse files Browse the repository at this point in the history
Summary:
Fixes #19774

I spotted that in  Xcode 10 beta `CURRENT_ARCH` is set to string `undefined_arch`.  This PR will add fallback based on platform name (simulators are `x86_64` and everything since iPhone 5s is `arm64`).
Closes #19841

Differential Revision: D8619897

Pulled By: hramos

fbshipit-source-id: ed2ebaca105c6dcb40099f1a4aebe34d0660130c
  • Loading branch information
futuun authored and facebook-github-bot committed Jun 28, 2018
1 parent 3cd0737 commit e131fff
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/ios-configure-glog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
set -e

PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
CURRENT_ARCH="${CURRENT_ARCH:-armv7}"
CURRENT_ARCH="${CURRENT_ARCH}"

if [ -z "$CURRENT_ARCH" ] || [ "$CURRENT_ARCH" == "undefined_arch" ]; then
# Xcode 10 beta sets CURRENT_ARCH to "undefined_arch", this leads to incorrect linker arg.
# it's better to rely on platform name as fallback because architecture differs between simulator and device

if [[ "$PLATFORM_NAME" == *"simulator"* ]]; then
CURRENT_ARCH="x86_64"
else
CURRENT_ARCH="armv7"
fi
fi

export CC="$(xcrun -find -sdk $PLATFORM_NAME cc) -arch $CURRENT_ARCH -isysroot $(xcrun -sdk $PLATFORM_NAME --show-sdk-path)"
export CXX="$CC"
Expand Down

0 comments on commit e131fff

Please sign in to comment.