Skip to content

Issue: React Native BigNumber 0.2.3 incompatibility with Expo 51 and React Native 0.75.0 #69

Open
@dexterslabor

Description

@dexterslabor

Environment

  • Expo version: 51
  • React Native version: 0.75.0
  • react-native-bignumber version: 0.2.3
  • Xcode version: 16

Description

When using react-native-bignumber 0.2.3 with Expo 51 and React Native 0.75.0, there's an incompatibility issue that requires manual patching of the react-native-bignumber.podspec file.

First, I want to express my appreciation for this amazing project. It has really helped me speed up development, especially with features like quick-crypto. Thank you for your hard work on this valuable tool.

Steps to Reproduce

  1. Set up a project with Expo 51 and React Native 0.75.0
  2. Install react-native-bignumber@0.2.3
  3. Attempt to build the project

Expected Behavior

The project should build successfully without any manual modifications.

Actual Behavior

The build fails due to incompatibility issues with the react-native-bignumber.podspec file. Specifically, the xcodebuild command exits with error code 65. Here's the detailed error message:

› Compiling react-native-bignumber Pods/react-native-bignumber » MGBigNumberHostObject.cpp
› Compiling react-native-bignumber Pods/react-native-bignumber » BigNumberModule.mm
❌ fatal error: too many errors emitted, stopping now [-ferror-limit=]
› Compiling Pods/ReactCodegen » safeareacontextJSI-generated.cpp
› Compiling Pods/ReactCodegen » safeareacontext-generated.mm
› Compiling Pods/ReactCodegen » rnsvgJSI-generated.cpp
› Compiling Pods/ReactCodegen » rnsvg-generated.mm
› Compiling Pods/ReactCodegen » rnscreensJSI-generated.cpp
› Compiling Pods/ReactCodegen » rnscreens-generated.mm
› Compiling Pods/ReactCodegen » rnreanimatedJSI-generated.cpp
› Compiling Pods/ReactCodegen » rnreanimated-generated.mm
Run script build phase '[CP-User] [RN]Check rncore' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'React-FabricComponents' from project 'Pods')
Run script build phase '[CP-User] Generate app.config for prebuilt Constants.manifest' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXConstants' from project 'Pods')
› 1 error(s), and 4 warning(s)
CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.

Solution

A post-install script is required to patch the react-native-bignumber.podspec file. The patch adds the CLANG_CXX_LANGUAGE_STANDARD configuration to set the C++ standard to c++17.

Here's the diff of the changes:

--- node_modules/react-native-bignumber/react-native-bignumber.podspec 2024-09-24 12:57:52
+++ node_modules/react-native-bignumber/react-native-bignumber.podspec 2024-09-24 11:57:23
@@ -32,7 +32,8 @@
 "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" "
 }
 s.xcconfig = {
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\""
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"",
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
 }
 s.dependency "OpenSSL-Universal", "~> 1.1.180"

Proposed Fix

Update the react-native-bignumber.podspec file in version 0.2.3 (and potentially future versions) to include the CLANG_CXX_LANGUAGE_STANDARD configuration by default, setting it to "c++17".

Additional Notes

This issue affects projects using react-native-bignumber 0.2.3 with newer versions of Expo and React Native. Implementing this fix in the package itself would prevent the need for manual patching and improve compatibility with current and future versions of Expo and React Native.

Once again, thank you for this fantastic project. Features like quick-crypto have been instrumental in speeding up our development process. We're looking forward to continuing to use and contribute to this project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions