react-native: pod install fails due to glog

When running pod install in my project, it fails with the error: error: C compiler cannot create executables Screen Shot 2019-07-09 at 4 13 34 PM

React Native version: 0.60.0

System:
    OS: macOS 10.15
    CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
    Memory: 4.15 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 8.16.0 - ~/.nvm/versions/node/v8.16.0/bin/node
    Yarn: 1.16.0 - ~/.yarn/bin/yarn
    npm: 6.9.1 - ~/.nvm/versions/node/v8.16.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
    Android SDK:
      Android NDK: 19.2.5345600
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 11.0/11M362v - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.0 => 0.60.0
  npmGlobalPackages:
    eslint-plugin-react-native: 3.7.0

I can also reproduce this when not using the beta SDK:

System:
    OS: macOS 10.15
    CPU: (4) x64 Intel(R) Core(TM) i7-7567U CPU @ 3.50GHz
    Memory: 4.04 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 8.16.0 - ~/.nvm/versions/node/v8.16.0/bin/node
    Yarn: 1.16.0 - ~/.yarn/bin/yarn
    npm: 6.9.1 - ~/.nvm/versions/node/v8.16.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      Android NDK: 19.2.5345600
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6
    react-native: 0.60.0 => 0.60.0
  npmGlobalPackages:
    eslint-plugin-react-native: 3.7.0

Steps To Reproduce

I found this issue when running pod install in my pre-existing project that I have upgraded to RN 0.60. But, I can reproduce the exact same error when running react-native init test and the error occurs when it gets to pod install

Describe what you expected to happen: The script not to crash and pod install to finish running

Snack, code example, or link to a repository: Just do react-native init test and it gives the error

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 14
  • Comments: 81

Most upvoted comments

As per https://github.com/facebook/react-native/issues/18408#issuecomment-386696744 (thanks @YuryKorovko !)

sudo xcode-select --switch /Applications/Xcode.app
cd ios && pod install

Fixed!

Seems to be an issue with Xcode after a new install. I resolved this issue on my machine by:

  1. launch Xcode
  2. from Xcode menu, select Preferences
  3. select Locations tab
  4. select a value for Command Line Tools. Mine was previously blank.

This assumes you’ve already got command line tools installed.

You may be able to achieve the same result from xcode-select on the command line, but I didn’t try that.

@chrisspankroy I figured it out. It is the environment variables. I had LDFLAGS and CPPFLAGS set. After unsetting those, the pod installation worked.

That did not work for me

I had almost same error log and I could find the error with the path in config.log. So in my case, the problem existed in Xcode’s path.

I had two Xcode installed and they were placed like /Applications/Xcode 10.3.app and /Application/Xcode 11.1.app which caused the problem because of space in the path.

After renaming the selected Xcode to /Application/Xcode.app, it works!

Hi @chrisspankroy I have the same issue here. Run gem update xcodeproj fix this issue. Hope that will work out for you too.

Restarting my computer then run pod install again fixed the problem for me. It should be noted that I did run sudo xcode-select --switch /Applications/Xcode.app first.

I tried react-native getting started’s React Native CLI Quickstart for MacOS for iOS https://facebook.github.io/react-native/docs/getting-started.html and confirm that AwesomeProject did not install, again because of glog

update

This was my error output: Screen Shot 2019-09-22 at 1 03 04 AM

The important part was dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib

I resolved it by following these instructions (from https://stackoverflow.com/questions/54261455/library-not-loaded-usr-local-opt-readline-lib-libreadline-7-dylib): cd /usr/local/opt/readline/lib ln -s libreadline.8.0.dylib libreadline.7.dylib

@panyar That did not work for me. Thanks though

I solved the problem with $ sudo xcode-select --switch /Applications/Xcode.app. Important: restart your terminal after executing this command ! Then you can do cd ios && pod install

Not work for me too. =/

Restarting my computer then run pod install again fixed the problem for me. It should be noted that I did run sudo xcode-select --switch /Applications/Xcode.app first.

Thanks! This worked for me

As per #18408 (comment) (thanks @YuryKorovko !)

sudo xcode-select --switch /Applications/Xcode.app
cd ios && pod install

Fixed!

it’s not working

image

On /Application/Xcode.app --> Make sure your it’s Xcode.app. I’ve done lots of R & D on this. In my case, I had multiple Xcodes on my mac, so I’ve renamed it to like Xcode 11.4.1.app & Xcode 10.4.app, So I renamed the Xcode 11.4.1.app to Xcode.app, and boom, It’s worked!!!

As a side note, if you have more than one Xcode installation and one of them has whitespaces in it’s name, Xcode 11.3.app as an example, it would give you the same error.

Rename your instance of Xcode in Applications folder, select the new file:

sudo xcode-select --switch /Applications/<NewName>.app

and it should work nicely. 😃

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

Worked for me no restart needed

Since macOS encourages ZSH, I think a lot of mac users may fall into this trap. In setting up the z-shell (zsh), ~/.zprofile is made. Somehow, I have these 2 lines in the file:

export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"

As @yaizudamashii has said, unset them: Delete or comment those lines in the file using: vim ~/.zprofile!

sudo xcode-select --switch /Applications/Xcode.app worked for me also, thank you all.

I am still having this issue

@dalu-ao I installed the Xcode 12.5.1 instead of Xcode 13 beta, reinstall Cocoapods and it works. Thank you very much for your kind help sir.

Seems to be an issue with Xcode after a new install. I resolved this issue on my machine by:

  1. launch Xcode
  2. from Xcode menu, select Preferences
  3. select Locations tab
  4. select a value for Command Line Tools. Mine was previously blank.

This assumes you’ve already got command line tools installed.

You may be able to achieve the same result from xcode-select on the command line, but I didn’t try that.

Solved

@lancejpollard works for me. My ~/.zshrc added env for llvm things before.

Removing LDFLAGS and CPPFLAGS fixed it for me!

I faced a similar issue with Flipper-GLog dependency, I was using macOS Catalina (with XCode 11) Below steps helped me to resolve this issue:

  1. Rename the Xcode app name, make sure the app name does not include space character.(Xcode 11.app to Xcode11.app)
  2. Switch to the Xcode with sudo xcode-select --switch sudo xcode-select -switch /Applications/Xcode11.app/
  3. Pod install

please got to ios folder and run this command sudo xcode-select --switch /Applications/Xcode.app

Since macOS encourages ZSH, I think a lot of mac users may fall into this trap. In setting up the z-shell (zsh), ~/.zprofile is made. Somehow, I have these 2 lines in the file:

export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"

As @yaizudamashii has said, unset them: Delete or comment those lines in the file using: vim ~/.zprofile!

That solved my problem

Hello i use window so far your solution

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

I use window and currently i was detaching expo from my project and pod install bring error during install glog tha scropt is too old or missing so how can i fix that and cant run sudo command in window

Update: 🎉 Good news here, It seems that react-native@0.61.1 solves this problem. Official init demo is working for me now.

Just an update: I still haven’t found a solution to this, but adding sudo to the configure script to get it to work isn’t a solution. Sure it might get the configure script to work, but it messes up your file permissions and doesn’t even help solve the actual problem 😕

This looks like a problem with glog or my environment. I was download glog and try to install it separately. When I run ./configure under the glog folder, there is the same problem as react-native project.

Finally, I found a way to solve the failure of installing glog, just run install script as root, sudo ./configure

Unfortunately, pod install does not support running as root.