-
Notifications
You must be signed in to change notification settings - Fork 47
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
AAR packaged libc++_shared.so? #69
Comments
+1 |
1 similar comment
+1 |
I've played around with I'm seeing errors like this:
Unless we find a solution for that, we won't be able to change the default for our distribution. |
Related to #62 |
Piggybacking here as we're facing the same exact issue on React Native. We're looking into consume I think the best approach here would be to ship 2 distributions of fbjni, one with
We're currently blocked on React Native with a:
And we have to resort to the current non-prefab approach, which relies on unbundling the libraries manually (the one described in this repo docs) which is essentially equivalent to drop the |
@cortinico I think they mean something slightly different by that quote, especially given the linked middleware guide. (For all others, it's super worth a read! It succinctly answers the "whys" above. And it seems like we might be conflating bundling the shared C++ standard library with linking against it.) To have fbjni not link, use, and need the shared C++ standard library, we'd want to add an option to statically link fbjni into apps or libraries that use it. That could be done by distributing static archives (or just compiling the source) and giving the option to set the shared library name on the Java side (as mentioned in #62 (comment)). We might also want to provide a linker script to help people preserve the Java->C++ JNI entry points. (See https://developer.android.com/ndk/guides/middleware-vendors#using_the_stl). It seems like the Android guides would recommend this for most use cases, but fbjni isn't currently distributed this way, unfortunately. [Otherwise, fbjni has to dynamically link against the C++ standard library, since the standard library is (unfortunately) part of its interface, as per the middleware guide. (Another (probably worse) fix would be moving to a no-STL interface, as the guide notes.) Hopefully that answers @henryzx's initial "why" question, above.] All that said, it seems like maybe the app and using-library cases could be solved by just dynamically linking against (the same) C++ standard library as fbjni, bundled or not? The real pain comes when using two libraries that want different standard libraries. |
Following up here @cpsauer
According to this answer android/ndk#1283 (comment) from the folks on the NDK, the recommended approach is to use
To solve @henryzx problem, he could technically use a AGP will prioritize The solution I was suggesting was to publish 2 version/flavors of FBJNI (one with the bundled |
👍🏻 I suppose more generally, is it clear that FBJNI should be bundling libc++_shared at all, as opposed to just requiring it? |
could you clarify? As I'm not sure if you missed a not in your sentence. To reiterate: I believe FBJNI could bundle |
Back in June I created this library and published some AARs that only contain |
Sadly not, as we need to don't have |
What I really meant is that libcxx-provider would eliminate the last issue that prevents migration to "Prefab packaging without libcxx-provider is not suitable if the app project builds its own C++ code, given that the dependencies do not bundle To my understanding the |
Issue description
The libc++_shared.so shipped with fbjni.aar conflicts with our app's.
According to android official doc, they recommended libraries to ship native code as a single
so
file.Want to know why we don't static link it to single fbjni.so?
And is there any suggested way to resolve native conflicts like this?
thanks.
System Info
Android
The text was updated successfully, but these errors were encountered: