bazelbuild / bazelbuild/rules_android_ndk

android package with libc++_shared.so

Open
#93 9 comments 0 reactions 0 assignees View on GitHub
P2
Dominant language
Starlark
Stars
43
Forks
32
PR merge metrics
No merged PRs in 30d

Description

> 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 bazel-discuss@googlegroups.com
> - 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 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.