From e57de5f32fdc54821dc7bec019377b3db52c7562 Mon Sep 17 00:00:00 2001 From: Kudo Chien Date: Tue, 13 Apr 2021 21:24:18 -0700 Subject: [PATCH] Fix CI "Build Tests: Android Instrumentation Tests" errors (#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: https://github.com/facebook/react-native/pull/31352 Test Plan: Make CI green Reviewed By: JoshuaGross Differential Revision: D27757838 Pulled By: fkgozali fbshipit-source-id: 8f9c80a89c6240938218abacb8a82e3e2e71adbc --- ReactAndroid/src/main/jni/first-party/fb/BUCK | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ReactAndroid/src/main/jni/first-party/fb/BUCK b/ReactAndroid/src/main/jni/first-party/fb/BUCK index 0acfb090124..6baf5edcb97 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/BUCK +++ b/ReactAndroid/src/main/jni/first-party/fb/BUCK @@ -28,4 +28,8 @@ oss_cxx_library( deps = [ JNI_TARGET, ], + linker_flags = [ + "-llog", + ], + preferred_linkage = "static", )