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

Bug: android_library neverlink leaks native code (and maybe more?) #13216

Open
cpsauer opened this issue Mar 13, 2021 · 3 comments
Open

Bug: android_library neverlink leaks native code (and maybe more?) #13216

cpsauer opened this issue Mar 13, 2021 · 3 comments
Labels
not stale Issues or PRs that are inactive but not considered stale P2 We'll consider working on this in future. (Assignee optional) team-Android Issues for Android team type: bug

Comments

@cpsauer
Copy link
Contributor

cpsauer commented Mar 13, 2021

Description of the problem / feature request:

android_library has a neverlink option. Neverlink is supposed allow the library use the library during compilation but not bundle it or its dependencies into the APK--analogous to the (better named?), option cc_import.system_provided. From the (linked) android_library docs:

Only use this library for compilation and not at runtime. The outputs of a rule marked as neverlink will not be used in .apk creation. Useful if the library will be provided by the runtime environment during execution.

However, some files leak through neverlink and are bundled into the APK.

As an example, .so files from android_libraries JNI code are bundled into the final APK, regardless of neverlink.

The following TODO makes me wonder if the issue is resources more broadly? Can't see the Buganizer details bc I'm (no longer) a Googler.

// TODO(b/69668042): Always correctly apply neverlinking for resources

Neverlink does, however, work for Java code--at least judging from the change in dex size. I'm wondering if, perhaps, neverlink got brought over form java_library, but wasn't properly generalized to android_libraries?

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Just grab the NDK example, add neverlink, and give it a go.

What operating system are you running Bazel on?

macOS

What's the output of bazel info release?

4.0.0

@aiuto aiuto added team-Android Issues for Android team untriaged labels Mar 31, 2021
@ahumesky ahumesky added P2 We'll consider working on this in future. (Assignee optional) type: bug and removed untriaged labels Jun 18, 2021
@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label May 10, 2023
@cpsauer
Copy link
Contributor Author

cpsauer commented May 11, 2023

@bazelbuild/triage, this issue still relevant and a fix would be great. It impedes the use of Bazel to develop libraries for Android!

@github-actions github-actions bot removed the stale Issues or PRs that are stale (no activity for 30 days) label May 11, 2023
@cpsauer
Copy link
Contributor Author

cpsauer commented May 11, 2023

(@bazelbuild/triage doesn't seem to create a tag (no link) so I'm going to tag @sgowroji and @Pavank1992 manually. Please coach me if you'd have preferred otherwise--and maybe update the bot's instructions)

@sgowroji sgowroji added the not stale Issues or PRs that are inactive but not considered stale label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not stale Issues or PRs that are inactive but not considered stale P2 We'll consider working on this in future. (Assignee optional) team-Android Issues for Android team type: bug
Projects
None yet
Development

No branches or pull requests

4 participants