react-native: React Native 0.78.0 cannot run the iOS simulator properly.

Description

use xcode to run

Steps to reproduce

npx @react-native-community/cli@latest init MyApp4

React Native Version

0.78.0

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

$ npx @react-native-community/cli info
info Fetching system and libraries information...
System:
  OS: macOS 15.3.1
  CPU: (10) x64 Apple M4
  Memory: 35.52 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.12.2
    path: ~/.nvm/versions/node/v20.12.2/bin/node
  Yarn: Not Found
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v20.12.2/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    Android NDK: 17.1.4828580
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.25
    path: /usr/bin/javac
  Ruby:
    version: 3.4.1
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.78.0
    wanted: 0.78.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

Unknown type name '_START_GOOGLE_NAMESPACE_'

Reproducer

none

Screenshots and Videos

Image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

I have found the reason. Because we used DevEco-Studio to develop OpenHarmony applications. I added environment variables in .zshrc.

In my case, remove the following environment configuration

export DEVECO_SDK_HOME=/Applications/DevEco-Studio.app/Contents/sdk # command-line-tools/sdk
export PATH=/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/toolchains:$PATH
export PATH=/Applications/DevEco-Studio.app/Contents/tools/hvigor/bin:$PATH
export PATH=/Applications/DevEco-Studio.app/Contents/tools/ohpm/bin:$PATH
HDC_SERVER_PORT=7035
launchctl setenv HDC_SERVER_PORT $HDC_SERVER_PORT
export HDC_SERVER_PORT
export RNOH_C_API_ARCH=1

You can delete the environment variables one by one to troubleshoot the problem.

I hope to help friends who encounter this problem.


Don’t forget

  1. restart the terminal after removing it.
  2. Delete CocoaPods cache, /Library/Caches/CocoaPods
  3. Delete the project /ios/Pods/glog
  4. Finally, execute pod install in your project
/* src/config.h.  Generated from config.h.in by configure.  */
/* src/config.h.in.  Generated from configure.ac by autoheader.  */

/* define if glog doesn't use RTTI */
/* #undef DISABLE_RTTI */

/* Namespace for Google classes */
#define GOOGLE_NAMESPACE google

/* Define if you have the `dladdr' function */
#define HAVE_DLADDR 1

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the <execinfo.h> header file. */
#define HAVE_EXECINFO_H 1

/* Define if you have the `fcntl' function */
#define HAVE_FCNTL 1

/* Define to 1 if you have the <glob.h> header file. */
#define HAVE_GLOB_H 1

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the `pthread' library (-lpthread). */
#define HAVE_LIBPTHREAD 1

/* Define to 1 if you have the <libunwind.h> header file. */
#define HAVE_LIBUNWIND_H 1

/* define if you have google gflags library */
/* #undef HAVE_LIB_GFLAGS_DISABLED */

/* define if you have google gmock library */
/* #undef HAVE_LIB_GMOCK */

/* define if you have google gtest library */
/* #undef HAVE_LIB_GTEST */

/* define if you have libunwind */
/* #undef HAVE_LIB_UNWIND */

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* define if the compiler implements namespaces */
#define HAVE_NAMESPACES 1

/* Define if you have the 'pread' function */
#define HAVE_PREAD 1

/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1

/* Define to 1 if you have the <pwd.h> header file. */
#define HAVE_PWD_H 1

/* Define if you have the 'pwrite' function */
#define HAVE_PWRITE 1

/* define if the compiler implements pthread_rwlock_* */
#define HAVE_RWLOCK 1

/* Define if you have the 'sigaction' function */
#define HAVE_SIGACTION 1

/* Define if you have the `sigaltstack' function */
#define HAVE_SIGALTSTACK 1

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the <syscall.h> header file. */
/* #undef HAVE_SYSCALL_H */

/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H 1

/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <sys/ucontext.h> header file. */
#define HAVE_SYS_UCONTEXT_H 1

/* Define to 1 if you have the <sys/utsname.h> header file. */
#define HAVE_SYS_UTSNAME_H 1

/* Define to 1 if you have the <ucontext.h> header file. */
/* #undef HAVE_UCONTEXT_H */

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if you have the <unwind.h> header file. */
#define HAVE_UNWIND_H 1

/* define if the compiler supports using expression for operator */
#define HAVE_USING_OPERATOR 1

/* define if your compiler has __attribute__ */
#define HAVE___ATTRIBUTE__ 1

/* define if your compiler has __builtin_expect */
#define HAVE___BUILTIN_EXPECT 1

/* define if your compiler has __sync_val_compare_and_swap */
#define HAVE___SYNC_VAL_COMPARE_AND_SWAP 1

/* Define to the sub-directory in which libtool stores uninstalled libraries.
   */
#define LT_OBJDIR ".libs/"

/* Name of package */
#define PACKAGE "glog"

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "opensource@google.com"

/* Define to the full name of this package. */
#define PACKAGE_NAME "glog"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "glog 0.3.5"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "glog"

/* Define to the home page for this package. */
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "0.3.5"

/* How to access the PC from a struct ucontext */
/* #undef PC_FROM_UCONTEXT */

/* Define to necessary symbol if this constant uses a non-standard name on
   your system. */
/* #undef PTHREAD_CREATE_JOINABLE */

/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P 8

/* Define to 1 if you have the ANSI C header files. */
/* #undef STDC_HEADERS */

/* the namespace where STL code like vector<> is defined */
#define STL_NAMESPACE std

/* location of source code */
#define TEST_SRC_DIR "."

/* Version number of package */
#define VERSION "0.3.5"

/* Stops putting the code inside the Google namespace */
#define _END_GOOGLE_NAMESPACE_ }

/* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {
/* 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

I just tried the reproducer and it worked for me.

Image

My guess is that something went wrong when pod were installed. Please:

  1. Remove the ios/Pods, ios/Podfile.lock and ios/MyApp4.xcworkspace files
  2. re-run bundle exec pod install from the ios folder
  3. open the MyApp4.xcworkspace file, not the MyApp4.xcodeproj

@wiseqingyang this is how C/C++ modules work. Some modules requires to set some specific flags in order to properly build the module.

The ios-configure-glog.sh was supposed to configure the module for you, but, for some reason, it is not running in your system.

so by manually adding the config.h file, you are basically executing the script manually and applying the same output to your code.

I have found the reason. Because we used DevEco-Studio to develop OpenHarmony applications. I added environment variables in .zshrc.

In my case, remove the following environment configuration

export DEVECO_SDK_HOME=/Applications/DevEco-Studio.app/Contents/sdk # command-line-tools/sdk export PATH=/Applications/DevEco-Studio.app/Contents/sdk/default/openharmony/toolchains:$PATH export PATH=/Applications/DevEco-Studio.app/Contents/tools/hvigor/bin:$PATH export PATH=/Applications/DevEco-Studio.app/Contents/tools/ohpm/bin:$PATH HDC_SERVER_PORT=7035 launchctl setenv HDC_SERVER_PORT $HDC_SERVER_PORT export HDC_SERVER_PORT export RNOH_C_API_ARCH=1 You can delete the environment variables one by one to troubleshoot the problem.

I hope to help friends who encounter this problem.

Don’t forget

  1. restart the terminal after removing it.
  2. Delete CocoaPods cache, /Library/Caches/CocoaPods
  3. Delete the project /ios/Pods/glog
  4. Finally, execute pod install in your project

Thank you very much. You have solved my problem.