Skip to content

Symbol not found: (_JSGlobalContextSetInspectable)  #44077

Closed

Description

@master96

Description

When trying to run release built on iOS 15.8.2. App crashes as soon as it starts.

I was able to find issue in https://forums.developer.apple.com/forums/thread/749534

Note - We have react-native-firebase integration which requires to use static framework bundling.

I am assuming following check in /node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp isnt working

if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) {
   JSGlobalContextSetInspectable(ctx_, true);
 }

i get following error

dyld[1327]: Symbol not found: (_JSGlobalContextSetInspectable)
  Referenced from: '/private/var/containers/Bundle/Application/1867E253-BC84-4E34-BE05-EA20CAF16CD3/ProviderApp.app/ProviderApp'
  Expected in: '/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore'
Message from debugger: killed

I got it working for now updating it to following bit in -> /node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp

  #if ( __OSX_AVAILABLE_STARTING(MAC_NA, IPHONE_16_4))
      JSGlobalContextSetInspectable(ctx_, true);
#endif

Steps to reproduce

  1. Change scheme to release in XCode
  2. Run it on iOS =< 15.8.2

React Native Version

0.72.12

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.2.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 186.39 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.2
    path: ~/.nvm/versions/node/v18.18.2/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v18.18.2/bin/yarn
  npm:
    version: 10.2.2
    path: ~/.nvm/versions/node/v18.18.2/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11076708
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.12
    wanted: 0.72.12
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: false

Stacktrace or Logs

dyld[1327]: Symbol not found: (_JSGlobalContextSetInspectable)
  Referenced from: '/private/var/containers/Bundle/Application/1867E253-BC84-4E34-BE05-EA20CAF16CD3/ProviderApp.app/ProviderApp'
  Expected in: '/System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore'
Message from debugger: killed

Reproducer

Screenshots and Videos

No response

Activity

  1. added
    Needs: Repro
    on Apr 15, 2024
  2. github-actions commented on Apr 15, 2024

    @github-actions
    ⚠️ Missing Reproducible Example
    ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
    • If your bug is UI related: a Snack
    • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
  3. hash3r commented on Apr 22, 2024

    @hash3r

    @master96 thanks for reporting. The crash will be fixed with the PR #44185

  4. added
    Resolution: PR Submitted
    and removed
    Needs: Repro
    on Apr 23, 2024
  5. linaia commented on May 6, 2024

    @linaia

    I've tryed the fix for 0.72.10 -> when I build with XCode 15.3 (15E204a), same than @master96 , I have the following error :

    /..../node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp:406:7 Use of undeclared identifier '__AVAILABILITY_INTERNALIPHONE_16_4'

  6. linaia commented on May 7, 2024

    @linaia

    Here is the patch that worked for me :

    diff --git a/node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp b/node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp
    index 523b1be..c667741 100644
    --- a/node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp
    +++ b/node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp
    @@ -403,11 +403,13 @@ JSCRuntime::JSCRuntime(JSGlobalContextRef ctx)
     {
     #ifndef NDEBUG
     #ifdef _JSC_HAS_INSPECTABLE
    -  if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) {
    +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 16400
    +  if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *))
         JSGlobalContextSetInspectable(ctx_, true);
       }
     #endif
     #endif
    +#endif
     }
    
     JSCRuntime::~JSCRuntime() {
    
  7. linaia commented on May 15, 2024

    @linaia

    FYI according to apple support, heree is the documentation for running code on a specific platform or OS version :

    https://developer.apple.com/documentation/xcode/running-code-on-a-specific-version/

  8. cipolleschi commented on May 20, 2024

    @cipolleschi
    Contributor
  9. Saadnajmi commented on May 20, 2024

    @Saadnajmi
    Contributor

    Here is the patch that worked for me :

    diff --git a/node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp b/node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp
    index 523b1be..c667741 100644
    --- a/node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp
    +++ b/node_modules/react-native/ReactCommon/jsc/JSCRuntime.cpp
    @@ -403,11 +403,13 @@ JSCRuntime::JSCRuntime(JSGlobalContextRef ctx)
     {
     #ifndef NDEBUG
     #ifdef _JSC_HAS_INSPECTABLE
    -  if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *)) {
    +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 16400
    +  if (__builtin_available(macOS 13.3, iOS 16.4, tvOS 16.4, *))
         JSGlobalContextSetInspectable(ctx_, true);
       }
     #endif
     #endif
    +#endif
     }
    
     JSCRuntime::~JSCRuntime() {
    

    __MAC_OS_X_VERSION_MAX_ALLOWED >= 16400 means you're checking that you're compiling for an Xcode version that supports macOS 16.4+.. which doesn't exist (the latest is macOS 14). So it just ifdefs the code out, which means that direct debugging with JavascriptCore is broken for iOS 16.4+. This is currently the case with the latest fixes to React Native. The "proper" fix AFAIK is to weak link JacascriptCore. I have a fix for cocoapods out (#39549) but I'm not sure it will get merged due to other issues. If you aren't using JSC and are using Hermes, then I suppose it doesn't matter if you keep the ifdef in.

  10. jenskuhrjorgensen commented on Jun 19, 2024

    @jenskuhrjorgensen

    The fix for this was patched to all version of RN >= 0.72:
    ae4c62a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: PR Submitted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions