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

Symbol not found: (_JSGlobalContextSetInspectable) #44077

Closed
master96 opened this issue Apr 15, 2024 · 9 comments
Closed

Symbol not found: (_JSGlobalContextSetInspectable) #44077

master96 opened this issue Apr 15, 2024 · 9 comments
Labels
Resolution: PR Submitted A pull request with a fix has been provided.

Comments

@master96
Copy link

master96 commented Apr 15, 2024

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

@github-actions github-actions bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Apr 15, 2024
Copy link

⚠️ 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.

@hash3r
Copy link

hash3r commented Apr 22, 2024

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

@cipolleschi
Copy link
Contributor

@cortinico cortinico added Resolution: PR Submitted A pull request with a fix has been provided. and removed Needs: Triage 🔍 Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Apr 23, 2024
@linaia
Copy link

linaia commented May 6, 2024

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'

@linaia
Copy link

linaia commented May 7, 2024

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() {

@linaia
Copy link

linaia commented May 15, 2024

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/

@cipolleschi
Copy link
Contributor

cc. @Saadnajmi

@Saadnajmi
Copy link
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.

@jenskuhrjorgensen
Copy link

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
Labels
Resolution: PR Submitted A pull request with a fix has been provided.
Projects
None yet
Development

No branches or pull requests

7 participants