dev1ce
dev1ce

Reputation: 1717

react native iOS pod install stuck on Installing glog (0.3.5)

I'm on m1 chip and when I ran pod install in my project's ios/ folder, the operation gets stuck at -> Installing glog (0.3.5), I waited for like 1 hr and 40 mins, but still it Was stuck at the same step. My internet is working fine. After a while growing through similar question answers on SO/Github, I added --verbose argument to get the logs of what is happening behind the scenes, and below is the output (not going forward after patching file config.sub step):

-> Installing glog (0.3.5)
 > Git download
 > Git download
     $ /usr/bin/git clone https://github.com/google/glog.git
     /var/folders/0y/rq93q_q13xl4p8kf4qmnld480000gn/T/d20221220-78496-8l9458 --template=
     --single-branch --depth 1 --branch v0.3.5
     Cloning into '/var/folders/0y/rq93q_q13xl4p8kf4qmnld480000gn/T/d20221220-78496-8l9458'...
     Note: switching to 'a6a166db069520dbbd653c97c2e5b12e08a8bb26'.

     You are in 'detached HEAD' state. You can look around, make experimental
     changes and commit them, and you can discard any commits you make in this
     state without impacting any branches by switching back to a branch.

     If you want to create a new branch to retain commits you create, you may
     do so (now or later) by using -c with the switch command. Example:

       git switch -c <new-branch-name>

     Or undo this operation with:

       git switch -

     Turn off this advice by setting config variable advice.detachedHead to false

 > Running prepare command
   $ /bin/bash -c  set -e #!/bin/bash # Copyright (c) Meta Platforms, Inc. and 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="arm64"     fi fi  if [
   "$CURRENT_ARCH" == "arm64" ]; then     cat <<\EOF >>fix_glog_0.3.5_apple_silicon.patch
   diff --git a/config.sub b/config.sub index 1761d8b..43fa2e8 100755 --- a/config.sub +++
   b/config.sub @@ -1096,6 +1096,9 @@ case $basic_machine in        basic_machine=z8k-unknown
   os=-sim          ;; +    arm64-*) +      basic_machine=$(echo $basic_machine | sed
   's/arm64/aarch64/') +        ;;      none)       basic_machine=none-none     os=-none EOF      patch
   -p1 config.sub fix_glog_0.3.5_apple_silicon.patch 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  # Manually disable gflags include to fix
   issue https://github.com/facebook/react-native/issues/28446 sed -i ''
   's/\@ac_cv_have_libgflags\@/0/' src/glog/logging.h.in sed -i ''
   's/HAVE_LIB_GFLAGS/HAVE_LIB_GFLAGS_DISABLED/' src/config.h.in  ./configure --host
   arm-apple-darwin  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 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/"
   patching file config.sub

Podfile:

require File.join(File.dirname(`node --print "require.resolve('expo/package.json')"`), "scripts/autolinking")
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false

target 'myapp' do
  use_expo_modules!
  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
  config = use_native_modules!
  # config = use_frameworks!
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true
  
  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
   :flipper_configuration => FlipperConfiguration.disabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'myappTests' do
    inherit! :complete
    # Pods for testing
  end
  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

Output of npx react-native info:

info Fetching system and libraries information...
System:
    OS: macOS 12.5
    CPU: (8) arm64 Apple M1
    Memory: 1.20 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.2/bin/yarn
    npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
    Watchman: 2022.12.12.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 29, 30, 31, 33
      Build Tools: 30.0.3, 31.0.0, 33.0.0
      System Images: android-31 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.1/14B47b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: Not Found
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Can someone shed some light on this matter?

If anyone require any more information about the project/env, please ask, I'll try to provide it!

Thank you in advance!

Upvotes: 4

Views: 3289

Answers (1)

Shohimardon Rahimov
Shohimardon Rahimov

Reputation: 51

sudo xcode-select --switch /Applications/Xcode.app

restart terminal and do

cd ios && pod install

Upvotes: 5

Related Questions