Skip to content

android package with libc++_shared.so #93

Description

@jiqimaogou

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions