From b39c31589f64b82c5ec3b9cb4ace94289835a94a 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 --- 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 336ce46f03ad2..9754bb7a6e35e 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn @@ -1380,8 +1380,10 @@ 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_linux || is_chromeos) && !is_chromecast)) && + (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 8e42cf9f2f992..0bf9164d51a48 100644 --- a/build/config/linux/BUILD.gn +++ b/build/config/linux/BUILD.gn @@ -37,8 +37,10 @@ config("runtime_library") { defines = [ "OS_CHROMEOS" ] } + # Only target requires if ((!(is_chromeos_ash || is_chromeos_lacros) || default_toolchain != "//build/toolchain/cros:target") && + (current_toolchain != host_toolchain) && (!use_custom_libcxx || current_cpu == "mipsel")) { libs = [ "atomic" ] }