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

android package with libc++_shared.so #93

Open
jiqimaogou opened this issue Oct 28, 2019 · 7 comments
Open

android package with libc++_shared.so #93

jiqimaogou opened this issue Oct 28, 2019 · 7 comments
Labels

Comments

@jiqimaogou
Copy link

ATTENTION! Please read and follow:

  • if this is a question about how to build / test / query / deploy using Bazel, or a discussion starter, send it to [email protected]
  • if this is a bug or feature request, fill the form below as best as you can.

Description of the problem / feature request:

On Android, bazel always libc++_static instead of libc++_shared.so

I want to make so link with libc++_shared.so, but bazel always libc++_static.a.

https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java

  private static RuleConfiguredTargetBuilder init(
      RuleContext ruleContext,
      NestedSetBuilder<Artifact> filesBuilder,
      CppSemantics cppSemantics,
      JavaSemantics javaSemantics,
      AndroidSemantics androidSemantics)
      throws InterruptedException, RuleErrorException {

    ResourceDependencies resourceDeps =
        ResourceDependencies.fromRuleDeps(ruleContext, /* neverlink= */ false);

    validateRuleContext(ruleContext);

    NativeLibs nativeLibs =
        NativeLibs.fromLinkedNativeDeps(
            ruleContext,
            ImmutableList.of("deps"),
            androidSemantics.getNativeDepsFileName(),
            cppSemantics); // always create static mode cc_library!!!!!!

Feature requests: what underlying problem are you trying to solve with this feature?

I have many libraries depends libc++, if I use libc++_static, every library contains libc++_static, which make apk too large.

I want to package libc++_shared.so, how do I do?

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

bazel build a android apk.

What operating system are you running Bazel on?

mac 10.14.6

What's the output of bazel info release?

Replace this line with your answer.

If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.

0.29.1-homebrew

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD

Have you found anything relevant by searching the web?

no found.

Any other information, logs, or outputs that you want to share?

no

@jiqimaogou jiqimaogou changed the title android package with libc++_shared. android package with libc++_shared.so Oct 28, 2019
@jiqimaogou
Copy link
Author

bazel --android_dynamic_mode fully is not working too.

@mapleyuan
Copy link

I have the same problem. Any update?

@bernardyip
Copy link

My current workaround is to use the .so from here https://github.com/tintintin/android-opencv-example

@ahumesky ahumesky added the P2 label Dec 3, 2020
@AndroidInternal
Copy link

ping..

Same problem.

@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.

@cpsauer
Copy link
Contributor

cpsauer commented May 11, 2023

@bazelbuild/triage, I think control over which C++ standard library to use is very much still relevant, though this should probably now be moved over to https://github.com/bazelbuild/rules_android_ndk

Linking the correct stl is a key think to think about on android as a result of the NDK's design. See https://developer.android.com/ndk/guides/cpp-support. This issue is also touched on in (7.) of #5

@cpsauer
Copy link
Contributor

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)

@ahumesky ahumesky transferred this issue from bazelbuild/bazel Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants