From 0dcae7668b878b7db5da83643a8dfd7709865d3b Mon Sep 17 00:00:00 2001 From: Hongxu Jia Date: Fri, 22 Jan 2021 00:02:25 +0800 Subject: [PATCH] avoid link latomic failure on CentOS 8 host When host (such as CentOS 8) did not install libatomic, there was a link failure on native. In fact, only target requires to link atomic, the native does not. So link atomic for target only Upstream-Status: Inappropriate [oe specific] Signed-off-by: Hongxu Jia Signed-off-by: Randy MacLeod --- base/BUILD.gn | 2 ++ build/config/linux/BUILD.gn | 2 ++ 2 files changed, 4 insertions(+) diff --git a/base/BUILD.gn b/base/BUILD.gn index 1f0e5cc5f0fae..f75c71d26f727 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1544,7 +1544,9 @@ component("base") { # Needed for if using newer C++ library than sysroot, except if # building inside the cros_sdk environment - use host_toolchain as a # more robust check for this. + # Only target requires if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos)) && + (current_toolchain != host_toolchain) && host_toolchain != "//build/toolchain/cros:host") { libs += [ "atomic" ] } diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn index 131bb71d1d3b8..20f918ab82c9b 100644 --- a/build/config/linux/BUILD.gn +++ b/build/config/linux/BUILD.gn @@ -40,7 +40,9 @@ config("runtime_library") { defines = [ "OS_CHROMEOS" ] } + # Only target requires if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") && + (current_toolchain != host_toolchain) && (!use_custom_libcxx || current_cpu == "mipsel")) { libs = [ "atomic" ] }