From e131fffb37a545363daf11735a0243165b57f63f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mokijewski?= Date: Thu, 28 Jun 2018 15:18:55 -0700 Subject: [PATCH] fix undefined_arch error in Xcode 10 beta (#19841) 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 https://github.com/facebook/react-native/pull/19841 Differential Revision: D8619897 Pulled By: hramos fbshipit-source-id: ed2ebaca105c6dcb40099f1a4aebe34d0660130c --- scripts/ios-configure-glog.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/ios-configure-glog.sh b/scripts/ios-configure-glog.sh index e6a15febb..3840fc4eb 100755 --- a/scripts/ios-configure-glog.sh +++ b/scripts/ios-configure-glog.sh @@ -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"