realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.76k stars 572 forks source link

> Task :realm:buildCMakeDebug[arm64-v8a][realm-js-android-binding] FAILED . React native - 0.75.1 #6845

Closed SrinjoyBarman closed 1 month ago

SrinjoyBarman commented 1 month ago

How frequently does the bug occur?

Always

Description

si/react_scheduler.cpp:61:65)' to 'CallFunc' (aka 'function<void (jsi::Runtime &)>') for 2nd argument C/C++: virtual void invokeAsync( C/C++: ^ C/C++: /Users/satyaretail01/Documents/service-app-mobile/node_modules/react-native/ReactCommon/callinvoker/ReactCommon/CallInvoker.h:29:16: note: candidate function not viable: requires single argument 'func', but 2 arguments were provided C/C++: virtual void invokeAsync(CallFunc&& func) noexcept = 0; C/C++: ^ C/C++: /Users/satyaretail01/Documents/service-app-mobile/node_modules/react-native/ReactCommon/callinvoker/ReactCommon/CallInvoker.h:40:16: note: candidate function not viable: requires single argument 'func', but 2 arguments were provided C/C++: virtual void invokeAsync(std::function<void()>&& func) noexcept { C/C++: ^ C/C++: 1 error generated.

Task :realm:buildCMakeDebug[arm64-v8a][realm-js-android-binding] FAILED

Stacktrace & log output

No response

Can you reproduce the bug?

Always

Reproduction Steps

run yarn android

Version

latest - 12.13.0

What services are you using?

Atlas Device Sync

Are you using encryption?

Yes

Platform OS and version(s)

react native 0.75.1

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

sync-by-unito[bot] commented 1 month ago

➤ PM Bot commented:

Jira ticket: RJS-2888

SrinjoyBarman commented 1 month ago

I think react-native's class CallInvoker { public: virtual void invokeAsync(CallFunc&& func) noexcept = 0;

has added noexcept keyword. That is why this is failing in recent versions. When can we expect a patch to this please?

nthtrung09it commented 1 month ago

@SrinjoyBarman you can check here to see if it works for you: https://github.com/realm/realm-js/issues/6846#issuecomment-2294865629

kraenhansen commented 1 month ago

React Native's CallInvoker API changed with https://github.com/facebook/react-native/pull/43375, such that the func callback argument now takes a jsi::Runtime. This was first released as react-native@0.75.0.

Care was made in that PR to provide signatures for backward compatibility, but these were only added for overload that doesn't take a SchedulerPriority as first argument (which we depend on). As I see it, we have a few ways forward:

  1. Upstream a fix to RN adding the missing backward compatibility overloads.
  2. Fix the callback we pass to take a jsi::Runtime argument.
  3. Call the backwards compatibility overload that doesn't take a SchedulerPriority (without a jsi::Runtime in the func).

Option 1 will leave realm broken for 0.75.0 and 0.75.1 forever and depends on the grace and a hotfix from the React Native team to be immediately effective. Option 2 will make the coming release of realm backwards incompatible with react-native prior to 0.75.0 which would be very unfortunate and could potentially require a major version bump on our side. I believe our best option now is 3, as that will alleviate the immediate issue fast and good compatibility, although we'll be providing less context when calling into the call invoker.

This is a topmost priority of mine.

SrinjoyBarman commented 1 month ago

Got it @kraenhansen. Can you advise any patch for this so that i could edit the package itself as we need to get through this asap due to blocked deliverables. Or else, when can we expect the backwards compatibility?

SrinjoyBarman commented 1 month ago

@SrinjoyBarman you can check here to see if it works for you: #6846 (comment)

@nthtrung09it , your solution did work but encountered a new issue as follows:

kraenhansen commented 1 month ago

A fix was release with v12.13.1 - please take it for a spin and let us know how it goes 👍

SrinjoyBarman commented 1 month ago

Awesome! Thanks @kraenhansen

c100k commented 1 month ago

Thanks @kraenhansen for fixing and releasing so quickly. I can confirm that it fixes the build issue on my app, freshly upgraded to React Native 0.75.2.

shadhussain-crgl commented 3 weeks ago

I am having this issue when trying to run on Android: Execution failed for task ':realm:buildCMakeDebug[arm64-v8a][realm-js-android-binding]'. as well.

For it to work on iOS, I need the versions to be as such, otherwise pod install fails:

@realm/react: "^0.5.0",
react-native: "^0.71.4",
realm: "12.13.1"

Upgrading the RN version seems to make it not work on iOS. Is there a known fix that will support both iOS and Android?

kraenhansen commented 3 weeks ago

@shadhussain-crgl please open your own issue tracking this. We need the full stacktrace to debug it as this is just an indication that the gradle task failed - it doesn't reveal the underlying cause.