jose920405
jose920405

Reputation: 8049

'glog/logging.h' file not found

some time ago, every time I start a new project of react-native or when I install the modules I present this error.

'glog/logging.h' file not found.

I found a way to solve it

cd node_modules/react-native/third-party/glog-0.3.4
../../scripts/ios-configure-glog.sh

but it is very tedious to be running this every time.

It seems to be some bad configuration of node or something like that

Upvotes: 20

Views: 27777

Answers (9)

primordius
primordius

Reputation: 31

pod install fixed it for me

Apparently I can't upvote

Upvotes: 0

Amir Mousavi
Amir Mousavi

Reputation: 119

if you are on GNU/linux - for example in Debian based os you can fix this error simply by:

sudo apt install libgoogle-glog-dev

to install google logging library

Upvotes: 4

Bhaumik Surani
Bhaumik Surani

Reputation: 1833

I fixed it by deleting the podlock file and Pods folder
then pod install,
sharing here so that it might help someone.

Upvotes: 0

S Mohan
S Mohan

Reputation: 267

Just try cd ios && pod install

may it works

Upvotes: 6

madeinQuant
madeinQuant

Reputation: 1813

Hope this help

info Fetching system and libraries information...
System:
    OS: macOS 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz
    Memory: 680.81 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.8.1 - /usr/local/bin/node
    Yarn: 1.17.3 - /usr/local/bin/yarn
    npm: 6.10.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
  IDEs:
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7
    react-native-macos-cli: 2.0.1

=====================================    
1. rm -rf node_modules/ && yarn cache clean && yarn install
2. rm -rf ~/.rncache
3. cd node_modules/react-native/scripts
4. ./ios-install-third-party.sh (install folly-2016.10.31.00 double-conversion glog)
5. cd <Your-Project-Folder>/node_modules/react-native/third-party/glog*
6. ./configure
7. Xcode clean (Cmd + Shift + K) and build (react-native run-ios).

Upvotes: 1

Bhavik Modi
Bhavik Modi

Reputation: 1565

If any of these solution does not work, please check your project path.

Project path and/or directory names should not contain any space in its name or you can create project on Desktop or in Documents directory.

Upvotes: 1

Mohsen Molaei
Mohsen Molaei

Reputation: 144

if your problem hasn't solved after ./configure ,

init project with older versions

react-native init --version 0.57.1 test2

List of the version of react-native is here

https://facebook.github.io/react-native/versions

after that open Xcode , Clean, build in iphone 6 simulator

Upvotes: 0

Mike
Mike

Reputation: 21

Hello the problem come from the ios-configure-glog.sh you need to remplace this file with a newer version because on the 0.034 the test of simulator is missing...

The good code is

#!/bin/bash
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

Upvotes: 2

Justin
Justin

Reputation: 885

Assuming you are starting at your projects root

cd node_modules/react-native/third-party/glog-0.3.4

sh ../../scripts/ios-configure-glog.sh

ios-configure-glog.sh uses a relative path to ./configure so you have to change this or cd first or else it will error.

All props to @jose920405!

Upvotes: 30

Related Questions