-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
OP-SQLite cannot build with 0.74RC and bridgeless #43204
Comments
|
Hi @ospfranco, thanks for the issue. For Android, we are aware that codegen and autolinking are not working with the RC.0 as we needed a commit that landed right after the branch cut. It should be solved in RC1 For iOS, @dmytrorykun, can you provide any insight? I remember that we had a similar report of |
Summary: This diff removes extra argument from the `extractLibrariesFromJSON` call inside `findLibrariesFromReactNativeConfig`. This should fix the iOS failurte discribed in facebook#43204 Changelog: [iOS][Fixed] - Codegen correctly handles react-native.config.js. Reviewed By: cipolleschi Differential Revision: D54248400
Summary: This diff removes extra argument from the `extractLibrariesFromJSON` call inside `findLibrariesFromReactNativeConfig`. This should fix the iOS failurte discribed in facebook#43204 Changelog: [iOS][Fixed] - Codegen correctly handles react-native.config.js. Reviewed By: cipolleschi Differential Revision: D54248400
Summary: This diff removes extra argument from the `extractLibrariesFromJSON` call inside `findLibrariesFromReactNativeConfig`. This should fix the iOS failurte discribed in #43204 Changelog: [iOS][Fixed] - Codegen correctly handles react-native.config.js. Reviewed By: cipolleschi Differential Revision: D54248400 fbshipit-source-id: 2ae5d0d29f49725877559a5b0edd7d59f8bdefaa
For Android, I'm not sure this is the error I'm seeing? seems it doesn't like that I use the CallInvokerHolderImpl reference and it fails the compilation? How am I supposed to get a hold of the CallInvoker? The class package com.op.sqlite
import com.facebook.react.bridge.ReactContext
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl
class OPSQLiteBridge {
private external fun installNativeJsi(
jsContextNativePointer: Long,
jsCallInvokerHolder: CallInvokerHolderImpl,
docPath: String
)
private external fun clearStateNativeJsi()
fun install(context: ReactContext) {
val jsContextPointer = context.javaScriptContextHolder!!.get()
val jsCallInvokerHolder =
context.catalystInstance.jsCallInvokerHolder as CallInvokerHolderImpl
// Trick to get the base database path
val dbPath =
context.getDatabasePath("defaultDatabase").absolutePath.replace("defaultDatabase", "")
installNativeJsi(
jsContextPointer,
jsCallInvokerHolder,
dbPath
)
}
fun clearState() {
clearStateNativeJsi()
}
companion object {
val instance = OPSQLiteBridge()
}
} The error logs:
|
You're seeing this error because you're using
For the time being, you can overcome this build failure by annotating your class with: import com.facebook.react.common.annotations.FrameworkAPI
@OptIn(FrameworkAPI::class)
class OPSQLiteBridge {
...
} |
The methods on op-sqlite run in a different thread, therefore to return the data to JS without crashing the JS context I need to schedule the callback (or in this case promise resolve). I have used this extensively on other client modules whenever there needs to be async work that does not block the JS thread, e.g. authentication/fingerprint callbacks. Edit: I read up a bit on the RuntimeExecutor, which I guess is meant to replace the CallInvoker, I don't understand all the details though. Any pointers would be appreciated to understand where is the new arch headed to. |
After adding the annotation I'm getting the following exception when trying to access the callinvokerholderimpl:
What would be the correct way to access the callinvoker on bridgeless? |
@ospfranco sorry, I forgot to post an update here. iOS has been fixed #43210 |
Thanks in the mean time I will patch it |
@ospfranco |
@philIip I just tried to patch with your changes and I'm getting this error(s): I think my changes are correct, so don't know why am I getting that missing header error I changed both node_modules in the example project and parent folder |
@ospfranco I was able to repro the insta crash of OPSQLiteExample app locally just not with the same error as yours and rather as a SEG Fault as discussed in chat. Both the I was able to get past the app crash by updating the cpp-adapter.cpp to exactly the one on main Since you mentioned the change was not necessary for bridgeless as long as both the runtime and the invoker are there is all good, I think this should unblock you. |
Thanks for the help @arushikesarwani94! The app is now building correctly! 🎉 Waiting for instructions regarding iOS |
@ospfranco, can you patch #43600? that should resolve your build error - it works when i tested it locally. let me know if there's any unexpected runtime issues. i will also be picking into RC6 if you're willing to wait! |
I tried generating a patch-package with the changes but it failed to apply. Maybe some of these files are created on the install step? In any case, manually applying the changes to Here is the patch file in case you want to check if I did it correctly: |
oooo got it, seems like a classic merge conflict lol.... PageTarget got renamed to HostTarget after 0.74 cut. i have to push a change directly to 0.74 that renames HostTarget back to PageTarget in RCTBridge (Inspector) :P if you rename HostTarget to PageTarget in RCTBridge+Inspector your build should pass now |
@ospfranco, I can explain why the cxxBridge is nil here! Here's the goal: When people migrate to our stable apis (for turbomodules and fabric at least), we want them to cut ties with the backwards compatibility layers (i.e: this bridge proxy). That way, people only have to migrate once for the new architecture (i.e: when they adopt the stable apis). And after most people migrate migrate, as the framework authors, we can just sunset the backwards compatibility layers. The solution here would be this: just undo the turbomodule migration work you did for this module that accesses the bridge. That way, it'll just become a legacy module going through the interop layer, and it'll have access to the bridge. Once we figure out the stable api for give modules access to the runtime (likely c++ turbomodule), you'll just have to re-write this completely. I hope that's fine! |
I will give it a try, but this is not a normal turbo module. I just need to access the runtime so I can later bind c++ functions directly |
@RSNara i also have to say: i won't migrate this module to c++ turbo module, because I need access to native apis, in this case getting the library folder path and on Android getting the databases path. Same with other libraries I have, sometimes I call native apis from c++ Would this still work with the approach you suggested? |
i think to simplify this discussion, essentially if we revert the turbomodule migration, you will be able to access the runtime off of the bridge in bridgeless mode. i totally acknowledge this is confusing, but this is the original design decision made a while ago to couple turbomodule migration with bridgeless migration. if this is too involved, please let us know! we can reconsider this. when it comes to the stable api (c++ turbomodule), we can tackle that conversation later. |
We've picked the requested change (reactwg/react-native-releases#183) into the |
@philIip ok, I got it, it is cumbersome and I'm short on time, but I will try to get it soon a report how it goes. Thanks! |
Ok, reverting to an old module works in all archs. Will close for now, and I guess we can have a discussion when old modules will be completely retired. Like I said, I don't really care about having to migrate to a C++ Turbo Module, as long as I get to call the native functions that's all I need. |
Summary: Changelog: [Internal] fix for part of facebook#43204 RCTBridge+Private is transitively bringing in boost in 0.74, which is causing build errors for some libs that were originally depending on it. this is because boost is a special pod that needs separate handling to link correctly. let's simplify this problem by decoupling this header and moving the inspector specific logic into it's own category. Reviewed By: motiz88, dmytrorykun Differential Revision: D55228474 fbshipit-source-id: 28dacaf464b98fe1c164418934ab8101b47d7efb
Description
Hi, I'm trying to test the library against the latest RC and also trying to get bridgeless to work. So far I'm facing two issues with the included example app in my library repo.
iOS:
It seems the codegen script is expecting the src files to be in node_modules, but the builder-bob template links the dependency directly via
react-native.config.js
:And I get the following error when trying to install the pods:
Android
After turning on all the flags (and bumping the minSDK to 23) I get a compilation error but no output to what is wrong:
Steps to reproduce
If you want to take a look yourself here is the branch. Just install deps via
yarn
and then try to run the example app:cd example && yarn android
or the equivalent iOS commands.React Native Version
0.74.0-rc.0
Affected Platforms
Build - MacOS
Areas
Bridgeless - The New Initialization Flow
Output of
npx react-native info
Reproducer
https://github.com/OP-Engineering/op-sqlite/tree/bridgeless
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: