pod install failed due to glog during project initialisation
See original GitHub issueDescription
Got the below error
patching file config.sub
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... x86_64-apple-darwin13.4.0-strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk
checking whether the C compiler works... no
/Applications/anaconda3/bin/install: line 34: /bin/R: No such file or directory
/Users/xx/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-3d02b/missing: Unknown --is-lightweight option
Try /Users/xx/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-3d02b/missing --help for more information
configure: WARNING: missing script is too old or missing
configure: error: in /Users/xx/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-3d02b:
configure: error: C compiler cannot create executables
See config.log for more details
When following the initialization guide: https://reactnative.dev/docs/environment-setup (MacOS and iOS).
Version
0.69.4
Output of npx react-native info
System:
OS: macOS 12.5
CPU: (8) x64 Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
Memory: 200.84 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 18.7.0 - ~/.nvm/versions/node/v18.7.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.17.0 - ~/.nvm/versions/node/v18.7.0/bin/npm
Watchman: 2022.08.15.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8193401
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_332-internal - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: ^0.69.4 => 0.69.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
I follow the guide (https://reactnative.dev/docs/environment-setup). After “npx react-native init AwesomeProject”, the following error pops up:
✔ Downloading template
✔ Copying template
✔ Processing template
✖ Installing CocoaPods dependencies (this may take a few minutes)
✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./ReactNativeAttentionTestApp/ios && pod install".
After running “cd ./ReactNativeAttentionTestApp/ios && pod install”, the issue occurs.
Snack, code example, screenshot, or link to a repository
cd ./ReactNativeAttentionTestApp/ios && pod install
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Downloading dependencies
Installing CocoaAsyncSocket (7.6.5)
Installing DoubleConversion (1.1.6)
Installing FBLazyVector (0.69.4)
Installing FBReactNativeSpec (0.69.4)
Installing Flipper (0.125.0)
Installing Flipper-Boost-iOSX (1.76.0.1.11)
Installing Flipper-DoubleConversion (3.2.0.1)
Installing Flipper-Fmt (7.1.7)
Installing Flipper-Folly (2.6.10)
Installing Flipper-Glog (0.5.0.5)
Installing Flipper-PeerTalk (0.0.4)
Installing Flipper-RSocket (1.4.3)
Installing FlipperKit (0.125.0)
Installing OpenSSL-Universal (1.1.1100)
Installing RCT-Folly (2021.06.28.00-v2)
Installing RCTRequired (0.69.4)
Installing RCTTypeSafety (0.69.4)
Installing React (0.69.4)
Installing React-Codegen (0.69.4)
Installing React-Core (0.69.4)
Installing React-CoreModules (0.69.4)
Installing React-RCTActionSheet (0.69.4)
Installing React-RCTAnimation (0.69.4)
Installing React-RCTBlob (0.69.4)
Installing React-RCTImage (0.69.4)
Installing React-RCTLinking (0.69.4)
Installing React-RCTNetwork (0.69.4)
Installing React-RCTSettings (0.69.4)
Installing React-RCTText (0.69.4)
Installing React-RCTVibration (0.69.4)
Installing React-bridging (0.69.4)
Installing React-callinvoker (0.69.4)
Installing React-cxxreact (0.69.4)
Installing React-jsi (0.69.4)
Installing React-jsiexecutor (0.69.4)
Installing React-jsinspector (0.69.4)
Installing React-logger (0.69.4)
Installing React-perflogger (0.69.4)
Installing React-runtimeexecutor (0.69.4)
Installing ReactCommon (0.69.4)
Installing SocketRocket (0.6.0)
Installing Yoga (1.14.0)
Installing YogaKit (1.18.1)
Installing boost (1.76.0)
Installing fmt (6.2.1)
Installing glog (0.3.5)
[!] /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
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-apple-darwin-strip... x86_64-apple-darwin13.4.0-strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for arm-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk
checking whether the C compiler works... no
/Applications/anaconda3/bin/install: line 34: /bin/R: No such file or directory
/Users/zhongs/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-3d02b/missing: Unknown `--is-lightweight' option
Try `/Users/zhongs/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-3d02b/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: in `/Users/zhongs/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-3d02b':
configure: error: C compiler cannot create executables
See `config.log' for more details
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Pod Install Fails Due to Glog - react native - Stack Overflow
Try this: sudo xcode-select --switch /Applications/Xcode.app. change /Applications/Xcode.app to your Xcode's app path.
Read more >How to fix “pod install” error in React Native on Mac M1
Run again the same command React Native suggested you earlier, but using Apple's Rosetta 2: cd ./AwesomeApp/ios && sudo arch -x86_64 pod install...
Read more >Installation | React Native Navigation - Open Source
Make sure your Xcode is updated. We recommend editing .h and .m files in Xcode as the IDE will usually point out common...
Read more >CocoaPods Fails On Apple Silicon | Apple Developer Forums
uninstalling the cocoapods package through gem (sudo gem uninstall cocoapods) and reinstalling it with homebrew (brew install cocoapods) fixed my problem.
Read more >Managed EAS iOS build fails on Glob (pod install)
I got this far when encountering this pod install problem I'm stumped on. Using SDK 44 in a managed project. expo-env-info 1.0.5 environment ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks!
I removed these flags and clear the anaconda3 added stuff in the ./bash_profile file and pod install succeeded!
swift集成RN,pod install之后就报错/Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `force_encoding’: can’t modify frozen String: “relative URI: /Users/hepengcheng/Desktop/ReactNative&Native/testReactNative/ios/node_modules/react-native/third-party-podspecs/DoubleConversion.podspec” (FrozenError) 这个如何解决呢
下面是打印信息
pod install Analyzing dependencies Fetching podspec for
DoubleConversion
from../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Traceback (most recent call last): 28: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in<main>' 27: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in
eval’ 26: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin/pod:23:in<main>' 25: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin/pod:23:in
load’ 24: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/bin/pod:55:in<top (required)>' 23: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in
run’ 22: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:inrun' 21: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in
run’ 20: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:161:ininstall!' 19: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:240:in
resolve_dependencies’ 18: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:insection' 17: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:241:in
block in resolve_dependencies’ 16: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:416:inanalyze' 15: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:117:in
analyze’ 14: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:970:infetch_external_sources' 13: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in
section’ 12: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:971:inblock in fetch_external_sources' 11: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:971:in
each’ 10: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:972:inblock (2 levels) in fetch_external_sources' 9: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:993:in
fetch_external_source’ 8: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/external_sources/podspec_source.rb:11:infetch' 7: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:86:in
titled_section’ 6: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/external_sources/podspec_source.rb:19:inblock in fetch' 5: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/open-uri.rb:174:in
open_uri’ 4: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/open-uri.rb:233:inopen_loop' 3: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/open-uri.rb:233:in
catch’ 2: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/open-uri.rb:235:inblock in open_loop' 1: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/open-uri.rb:218:in
block in open_loop’ /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/uri/generic.rb:1491:infind_proxy': relative URI: /Users/hepengcheng/Desktop/ReactNative&Native/testReactNative/ios/node_modules/react-native/third-party-podspecs/DoubleConversion.podspec (URI::BadURIError) 11: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in
<main>’ 10: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:ineval' 9: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin/pod:23:in
<main>’ 8: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin/pod:23:inload' 7: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/bin/pod:55:in
<top (required)>’ 6: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:inrun' 5: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:324:in
run’ 4: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:337:inrescue in run' 3: from /Users/hepengcheng/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:396:in
handle_exception’ 2: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:66:inreport_error' 1: from /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in
report’ /Users/hepengcheng/.rvm/gems/ruby-2.7.5/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `force_encoding’: can’t modify frozen String: “relative URI: /Users/hepengcheng/Desktop/ReactNative&Native/testReactNative/ios/node_modules/react-native/third-party-podspecs/DoubleConversion.podspec” (FrozenError)env TERM_SESSION_ID=w0t0p0:65EB9C65-7107-4743-92EF-544984736C04 SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.7e7Xc29z5H/Listeners LC_TERMINAL_VERSION=3.4.15 COLORFGBG=15;0 ITERM_PROFILE=Hpc XPC_FLAGS=0x0 LANG=zh_CN.UTF-8 PWD=/Users/hepengcheng/Desktop/ReactNative&Native/testReactNative/ios/App-iOS-New SHELL=/bin/zsh __CFBundleIdentifier=com.googlecode.iterm2 TERM_PROGRAM_VERSION=3.4.15 TERM_PROGRAM=iTerm.app PATH=/Users/hepengcheng/.rvm/gems/ruby-2.7.5/bin:/Users/hepengcheng/.rvm/gems/ruby-2.7.5@global/bin:/Users/hepengcheng/.rvm/rubies/ruby-2.7.5/bin:/Users/hepengcheng/Documents/flutter/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/hepengcheng/Library/Android/sdk/tools:/Users/hepengcheng/Library/Android/sdk/platform-tools:/Users/hepengcheng/.rvm/bin LC_TERMINAL=iTerm2 COLORTERM=truecolor COMMAND_MODE=unix2003 TERM=xterm-256color HOME=/Users/hepengcheng TMPDIR=/var/folders/j6/62b37k4x1z788t1shkyd_6tc0000gn/T/ USER=John_H XPC_SERVICE_NAME=0 LOGNAME=John_H ITERM_SESSION_ID=w0t0p0:65EB9C65-7107-4743-92EF-544984736C04 __CF_USER_TEXT_ENCODING=0x0:25:52 SHLVL=1 OLDPWD=/Users/hepengcheng HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles HOMEBREW_PREFIX=/opt/homebrew HOMEBREW_CELLAR=/opt/homebrew/Cellar HOMEBREW_REPOSITORY=/opt/homebrew MANPATH=/opt/homebrew/share/man:: INFOPATH=/opt/homebrew/share/info: P9K_TTY=old _P9K_TTY=/dev/ttys002 PUB_HOSTED_URL=https://pub.flutter-io.cn FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn FLUTTER=/Users/hepengcheng/Documents/flutter ANDROID_HOME=/Users/hepengcheng/Library/Android/sdk ZSH=/Users/hepengcheng/.oh-my-zsh PAGER=less LESS=-R LSCOLORS=Gxfxcxdxbxegedabagacad P9K_SSH=0 AUTOJUMP_SOURCED=1 AUTOJUMP_ERROR_PATH=/Users/hepengcheng/Library/autojump/errors.log rvm_prefix=/Users/hepengcheng rvm_path=/Users/hepengcheng/.rvm rvm_bin_path=/Users/hepengcheng/.rvm/bin rvm_version=1.29.12 (latest) GEM_HOME=/Users/hepengcheng/.rvm/gems/ruby-2.7.5 GEM_PATH=/Users/hepengcheng/.rvm/gems/ruby-2.7.5:/Users/hepengcheng/.rvm/gems/ruby-2.7.5@global MY_RUBY_HOME=/Users/hepengcheng/.rvm/rubies/ruby-2.7.5 IRBRC=/Users/hepengcheng/.rvm/rubies/ruby-2.7.5/.irbrc RUBY_VERSION=ruby-2.7.5 rvm_alias_expanded= rvm_bin_flag= rvm_docs_type= rvm_gemstone_package_file= rvm_gemstone_url= rvm_niceness= rvm_nightly_flag= rvm_only_path_flag= rvm_pretty_print_flag= rvm_proxy= rvm_quiet_flag= rvm_ruby_bits= rvm_ruby_file= rvm_ruby_make= rvm_ruby_make_install= rvm_ruby_mode= rvm_script_name= rvm_sdk= rvm_silent_flag= rvm_use_flag= rvm_hook= _=/usr/bin/env