Skip to content

Commit

Permalink
Link statically stdlibc++ for android builds
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Oct 22, 2020
1 parent a663039 commit 2de9565
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
7 changes: 7 additions & 0 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ config("abi_default") {
]
}
}

ldflags = cflags

if (current_os == "android") {
ldflags += [
"-static-libstdc++",
]
}
}

config("target_default") {
Expand Down
12 changes: 1 addition & 11 deletions src/android/CHIPTool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,4 @@ rsync -a out/android_arm64/lib/jni/* src/android/CHIPTool/app/src/main/jniLibs
## JAR and .so libraries will be copy to target directories.
```

6. You will also need the "libc++\_shared.so" file in the jniLibs folder. This
file comes packaged with Android NDK and can be found under
`$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$TARGET`, e.g.

`rsync -a "${ANDROID_NDK_HOME}/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so" src/android/CHIPTool/app/src/main/jniLibs/arm64-v8a/`

(Eventually hoping to not have to include this .so, but that needs some more
tweaking of the Android automake build rules. Include it in the interim to
be able to build the Android app).

7. 'Gradle sync' the Android project and run.
6. 'Gradle sync' the Android project and run.

0 comments on commit 2de9565

Please sign in to comment.