100

I'm not experienced so I can't really pinpoint what is the problem. Thanks for the help.

I cloned this repo: https://github.com/flatlogic/react-native-starter.git

And was trying to follow the steps below:

Clone the repo

git clone https://github.com/flatlogic/react-native-starter.git

Navigate to clonned folder and Install dependencies

cd react-native-starter && yarn install

Install Pods

cd ios && pod install

When I got to the pod install I'm getting that error.


karar@Karars-MacBook-Air ios % pod install
Auto-linking React Native modules for target `ReactNativeStarter`: BVLinearGradient, RNCMaskedView, RNGestureHandler, RNLocalize, RNReanimated, RNScreens, RNVectorIcons, ReactNativeUiLib, react-native-safe-area-context, and toolbar-android
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Downloading dependencies
Installing BVLinearGradient (2.5.6)
Installing DoubleConversion (1.1.6)
Installing FBLazyVector (0.63.1)
Installing FBReactNativeSpec (0.63.1)
Installing Folly (2020.01.13.00)
Installing RCTRequired (0.63.1)
Installing RCTTypeSafety (0.63.1)
Installing RNCMaskedView (0.1.10)
Installing RNGestureHandler (1.8.0)
Installing RNLocalize (1.4.2)
Installing RNReanimated (1.13.1)
Installing RNScreens (2.11.0)
Installing RNVectorIcons (6.7.0)
Installing React (0.63.1)
Installing React-Core (0.63.1)
Installing React-CoreModules (0.63.1)
Installing React-RCTActionSheet (0.63.1)
Installing React-RCTAnimation (0.63.1)
Installing React-RCTBlob (0.63.1)
Installing React-RCTImage (0.63.1)
Installing React-RCTLinking (0.63.1)
Installing React-RCTNetwork (0.63.1)
Installing React-RCTSettings (0.63.1)
Installing React-RCTText (0.63.1)
Installing React-RCTVibration (0.63.1)
Installing React-callinvoker (0.63.1)
Installing React-cxxreact (0.63.1)
Installing React-jsi (0.63.1)
Installing React-jsiexecutor (0.63.1)
Installing React-jsinspector (0.63.1)
Installing ReactCommon (0.63.1)
Installing ReactNativeUiLib (3.41.0)
Installing Yoga (1.14.0)
Installing boost-for-react-native (1.63.0)
Installing glog (0.3.5)
[!] /bin/bash -c 
set -e
#!/bin/bash
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

set -e

PLATFORM_NAME="${PLATFORM_NAME:-iphoneos}"
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"

# Remove automake symlink if it exists
if [ -h "test-driver" ]; then
    rm test-driver
fi

./configure --host arm-apple-darwin

# Fix build for tvOS
cat << EOF >> src/config.h

/* Add in so we have Apple Target Conditionals */
#ifdef __APPLE__
#include <TargetConditionals.h>
#include <Availability.h>
#endif

/* Special configuration for AppleTVOS */
#if TARGET_OS_TV
#undef HAVE_SYSCALL_H
#undef HAVE_SYS_SYSCALL_H
#undef OS_MACOSX
#endif

/* Special configuration for ucontext */
#undef HAVE_UCONTEXT_H
#undef PC_FROM_UCONTEXT
#if defined(__x86_64__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
#elif defined(__i386__)
#define PC_FROM_UCONTEXT uc_mcontext->__ss.__eip
#endif
EOF

# Prepare exported header include
EXPORTED_INCLUDE_DIR="exported/glog"
mkdir -p exported/glog
cp -f src/glog/log_severity.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/raw_logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/stl_logging.h "$EXPORTED_INCLUDE_DIR/"
cp -f src/glog/vlog_is_on.h "$EXPORTED_INCLUDE_DIR/"

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Library/Developer/CommandLineTools/usr/bin/cc -arch armv7 -isysroot 
checking whether the C compiler works... no
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
/Users/karar/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13/missing: Unknown `--is-lightweight' option
Try `/Users/karar/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/karar/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13':
configure: error: C compiler cannot create executables
See `config.log' for more details

karar@Karars-MacBook-Air ios % 
Karrar Al-Mimar
  • 4,199
  • 3
  • 12
  • 15
  • 2
    The core error here is `xcrun: error: SDK "iphoneos" cannot be located` -- it might be helpful to focus in on it wrt. title and tagging. – Charles Duffy Jul 28 '21 at 18:07
  • 2
    (and as far as I can tell this bug has nothing whatsoever to do with terminal emulation, so the terminal tag could probably be removed. The terminal is just the thing that displays the output of a program and collects input on its behalf; beyond that role, it has no control over what the program being run inside of it actually does). – Charles Duffy Jul 28 '21 at 18:08
  • Thanks @CharlesDuffy. Changed. Will stack re-promote the question since I changed the title? – Karrar Al-Mimar Jul 29 '21 at 16:30
  • 1
    Updates do in general move something back to the front page. (It's frowned on to do them just for that reason, but in this case it's clearly a better question as-edited, so you don't need to worry about criticism). – Charles Duffy Jul 29 '21 at 16:45

5 Answers5

304
  1. Launch Xcode
  2. Settings
  3. Locations
  4. Make sure there's a dropdown option selected for the command line tools

NOTE: Even if you're seeing Command Line Tools dropdown being selected with proper version, you might want to re-select it again. It will ask for login password

Fixed it for me.

enter image description here

fixed with:

enter image description here

Francesco Laiti
  • 1,791
  • 2
  • 13
  • 19
Karrar Al-Mimar
  • 4,199
  • 3
  • 12
  • 15
  • 53
    Even if you're seeing Command Line Tools dropdown being selected with proper version, you might want to re-select it again. It fixed the error in my case. – morph85 Dec 05 '22 at 06:53
  • 9
    For me, it was selected but when I reselected it asked for my login password and that fixed the issue for me. – Kashan Danish Mar 07 '23 at 20:35
  • 1
    Only the correction... open the XCode and in top menu: XCode > Preferences > Locations. – Leffa Apr 16 '23 at 20:27
  • 1
    It was already selected. So i reselected and it helped me as well. – ArkaneKhan Aug 01 '23 at 13:54
90

This related to those two issues https://github.com/facebook/react-native/issues/18408 https://github.com/facebook/react-native/issues/18408

so here is what works for me:

sudo xcode-select --switch /Applications/Xcode.app
berramou
  • 1,099
  • 9
  • 11
6

If you don't see a valid path under Command Line Tools that means it's not selected and you have to select it again.

enter image description here

If there is not path below command line tools dropdown

Naresh
  • 941
  • 9
  • 22
0

I think your pod install working fine and has done its job. You need to set up iPhone SDK on your mac then try to run cd ../ && react-native run-ios.

Follow this guide : React Native Environment set up on Mac OS with Xcode and Android Studio

Harsh Mishra
  • 862
  • 3
  • 15
  • 29
0

For Unity users: Open xcode and install all the updates.

I was building my project from a Mac pc instead of a Windows pc

Fenikkel
  • 51
  • 6