diff --git a/scripts/ios-configure-glog.sh b/scripts/ios-configure-glog.sh index e6a15febb90760..3840fc4ebc719c 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"