Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: Compile fails when gflags is installed #28446

Closed
KDederichs opened this issue Mar 30, 2020 · 11 comments
Closed

iOS: Compile fails when gflags is installed #28446

KDederichs opened this issue Mar 30, 2020 · 11 comments
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@KDederichs
Copy link
Contributor

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

When trying to build an iOS version of a react native app, the compilation of the glog (and Flipp-er-Glog) pods will fail if the machine has the gflags package installed (brew install gflags).
This seems to be due to the configure script picking up the gflags.h file and in turn enabling this line in logging.h by setting the if precompile flag to true:

#if 0
#include <gflags/gflags.h>
#endif

React Native version:

System:
    OS: macOS 10.15.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 16.84 GB / 64.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
    Yarn: 1.22.4 - ~/.yarn/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.14.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 24, 25, 26, 27, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-29 | Google Play Intel x86 Atom
  IDEs:
    Xcode: 11.4/11E146 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5

This bug should hit all existing RN versions that relay on glog and starting RN 62 also the Flipper integration.

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. install gflags via brew install gflags
  2. try to compile a fresh react native project that was setup AFTER! you installed gflags

Expected Results

The app should still compile regardless if the user has setup gflags or not.

Snack, code example, screenshot, or link to a repository:

Not needed

@stale
Copy link

stale bot commented Jun 28, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 28, 2020
@KDederichs
Copy link
Contributor Author

Still in the Backlog

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 29, 2020
@stale
Copy link

stale bot commented Oct 4, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 4, 2020
@KDederichs
Copy link
Contributor Author

I'd assume it's still an issue

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 11, 2020
@waqas19921
Copy link

I am also facing this issue it is due to wrong glog which is installed using brew. But why i have to remove all the glog in mac os.

@waqas19921
Copy link

Following steps worked for me

  1. Remove gflags from homebrew
    brew uninstall --ignore-dependencies gflags
  2. Run following command to clear all cache from pod and xcode.
    rm -rf ~/Library/Caches/CocoaPods Pods ~/Library/Developer/Xcode/DerivedData/*; pod deintegrate; pod setup; pod install;

@KDederichs
Copy link
Contributor Author

Yes uninstalling it "fixes" it.
The problem is that it sees the system level header files and tries to compile them into the project.
I actually did open a PR back in March that would fix the issue but so far no one cared :)
#28451

facebook-github-bot pushed a commit that referenced this issue Sep 8, 2021
Summary:
Fixes the issue explained in #28446
It basically disabled the gflags include before configure can detect the header on the users system.

## Changelog

[iOS] [Fixed] - Fixed inability to build apps when gflags is installed

Pull Request resolved: #28451

Test Plan: Tested by installing gflags `brew install gflags` and verifying that apps build after.

Reviewed By: javache

Differential Revision: D30345352

Pulled By: sota000

fbshipit-source-id: 04c98d7ddebe6708057407c4b4bf3701434822a3
@alesso-x
Copy link

I'm receiving the following error for glog using react-native 0.63.4. It might be a separate issue but seems glog and brew dependencies are conflicting.

checking build system type...
/Users/alesso/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13/missing: Unknown `--is-lightweight' option
Try `/Users/alesso/Library/Caches/CocoaPods/Pods/External/glog/2263bd123499e5b93b5efe24871be317-40a13/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
Invalid configuration `arm64-apple-darwin21.2.0': machine `arm64-apple' not recognized
configure: error: /bin/sh ./config.sub arm64-apple-darwin21.2.0 failed
System:
    OS: macOS 12.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 314.55 MB / 16.00 GB
    Shell: 3.3.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 17.3.1 - /opt/homebrew/bin/node
    Yarn: 1.22.17 - /opt/homebrew/bin/yarn
    npm: 8.3.0 - /opt/homebrew/bin/npm
    Watchman: 2022.01.03.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7935034
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: Not Found
    Python: 2.7.18 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: ~0.63.4 => 0.63.4
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Following the comments above, I removed gflags but still had the issue. I left gflags installed (it's a dependency for watchman) and uninstalled all my other brew dependencies. I went one by one installed each brew dependencies and ran pod install. I found that coreutils is the one causing the error.

@shubhambajoria11
Copy link

image

Open Xcode and go to Preferences.

then go to the command line tools and then select the Xcode version from the drop down
Also ensure that the below location is also visible (/Applications/Xcode.app)

This solved my problem

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 18, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

4 participants