Skip to content

Commit

Permalink
Fix CI "Build Tests: Android Instrumentation Tests" errors (facebook#…
Browse files Browse the repository at this point in the history
…31352)

Summary:
To fix [the CI error](https://app.circleci.com/pipelines/github/facebook/react-native/8708/workflows/d584348e-941f-4653-96c2-46375894dfaa/jobs/196410)
  There are two errors:
  `error: undefined reference to '__android_log_write'` which solved by adding `-llog` linker flag.

  `ld: error: cannot find -lc++` which workaround by static linking.
  For the root cause, I am thinking that is after [NDK r19](https://developer.android.com/ndk/guides/other_build_systems),
  the `-target` should specificy api level.
  However, buck does not add this accordingly, e.g. `-target armv7-none-linux-androideabi`
  Given wrong target will make NDK to have `cannot find -lc++` error.
  The workaround is to use static linking.
  Since it was an oss_cxx_library, the change should not have impact to Facebook internal testing.

## Changelog

[Internal] [Fixed] - Fix CI "Build Tests: Android Instrumentation Tests" errors

Pull Request resolved: facebook#31352

Test Plan: Make CI green

Reviewed By: JoshuaGross

Differential Revision: D27757838

Pulled By: fkgozali

fbshipit-source-id: 8f9c80a89c6240938218abacb8a82e3e2e71adbc
  • Loading branch information
Kudo authored and facebook-github-bot committed Apr 14, 2021
1 parent 08ef1df commit e57de5f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ReactAndroid/src/main/jni/first-party/fb/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ oss_cxx_library(
deps = [
JNI_TARGET,
],
linker_flags = [
"-llog",
],
preferred_linkage = "static",
)

0 comments on commit e57de5f

Please sign in to comment.