Skip to content

Conversation

@shadow3aaa
Copy link

No description provided.

@rsglobal
Copy link

rsglobal commented Nov 4, 2024

Hello folks,

I noticed this change wasn't merged, but it is necessary for this project to function on Ubuntu 24.04.

Also this diff code is required, otherwise libbinder_ndk isn't built.

--- a/binder_ndk_sys/build.rs
+++ b/binder_ndk_sys/build.rs
@@ -17,6 +17,8 @@ rust-version = "1.67"
 
 [lib]
 crate-type = ["cdylib"]
+
+[workspace]
 "#;
 
 fn build_stub() -> Result<()> {

So, is this project still alive? Do you need a help maintaining it? I would be happy to participate.

@MarijnS95
Copy link

MarijnS95 commented Nov 4, 2024

Traverse-Research@41045c6 - this commit also fails build.rs when nested cargo build fails, instead of silently continuing :).
I can PR that instead if you're interested.

@rsglobal just notice that Google engineers have published their upstream codebase to crates.io: rust-mobile/ndk#490 (comment)

That is the same codebase that this project was originally copied from (and furthermore never updated/maintained), but this was never mentioned in the README.

@rsglobal
Copy link

rsglobal commented Nov 4, 2024

Hi @MarijnS95 , It is nice to see you here.

I looked at the links you sent me and noticed the description Bindgen bindings to the Android binder, restricted to the NDK. This probably means some symbols necessary to run vendor services (HALs) are not visible/accessible.

While this project has a different approach, which allows runtime linking with /vendor/lib{64}/libbinder_ndk.so

And it looks like maintainers abandoned it, which is sad.

@MarijnS95
Copy link

@rsglobal nice to see you here too, seems our Android interests stay aligned and extend to Rust too.

Yes, those bindings are what the libbinder_ndk stub is for: https://cs.android.com/android/platform/superproject/main/+/main:frameworks/native/libs/binder/ndk/libbinder_ndk.map.txt;l=95-97;drc=0555fbf9ecde50d339ca2e8788ec0539d4397701

The symbols are there but cannot be dynamically linked at build-time, but they're found at runtime.

It's unfortunate to have two crates with ~exactly the same Rust code just to be able to change what and how it's linked. At runtime you might get away with dlopen() though? It's been a while since I experimented with connecting to services. Makes no sense that these symbols are hidden, since services can be connected to in Java as well.

Prslc added a commit to Prslc/binder_rs that referenced this pull request Nov 21, 2025
…ing generation

`binder_ndk_sys` was implicitly inheriting `workspace.package` fields
from the root workspace. This caused Cargo to override the crate's own
package configuration and interfered with its custom build logic,
leading to incorrect fallback behavior and preventing libbinder_ndk from
being generated.

Adding an explicit `[workspace]` section makes `binder_ndk_sys` a
standalone workspace root, disabling inheritance and restoring the
expected build process. This fixes build failures observed on Ubuntu
24.04 and other environments.

Ref: Kernel-SU#9 (comment)

Signed-off-by: Prslc <prslc113@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants