|
| 1 | +When host (such as CentOS 8) did not install libatomic, there was a |
| 2 | +link failure on native. In fact, only target requires to link atomic, |
| 3 | +the native does not. So link atomic for target only |
| 4 | + |
| 5 | +Upstream-Status: Inappropriate [oe specific] |
| 6 | + |
| 7 | +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
| 8 | +--- |
| 9 | + base/BUILD.gn | 2 ++ |
| 10 | + build/config/linux/BUILD.gn | 2 ++ |
| 11 | + 2 files changed, 4 insertions(+) |
| 12 | + |
| 13 | +diff --git a/base/BUILD.gn b/base/BUILD.gn |
| 14 | +index 1d97f72..aa3acb8 100644 |
| 15 | +--- a/base/BUILD.gn |
| 16 | ++++ b/base/BUILD.gn |
| 17 | +@@ -1294,8 +1294,10 @@ component("base") { |
| 18 | + # Needed for <atomic> if using newer C++ library than sysroot, except if |
| 19 | + # building inside the cros_sdk environment - use host_toolchain as a |
| 20 | + # more robust check for this. |
| 21 | ++ # Only target requires <atomic> |
| 22 | + if (!use_sysroot && |
| 23 | + (is_android || ((is_linux || is_chromeos) && !is_chromecast)) && |
| 24 | ++ (current_toolchain != host_toolchain) && |
| 25 | + host_toolchain != "//build/toolchain/cros:host") { |
| 26 | + libs += [ "atomic" ] |
| 27 | + } |
| 28 | +diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn |
| 29 | +index 80c5318..f05c0aa 100644 |
| 30 | +--- a/build/config/linux/BUILD.gn |
| 31 | ++++ b/build/config/linux/BUILD.gn |
| 32 | +@@ -28,8 +28,10 @@ config("runtime_library") { |
| 33 | + defines = [ "OS_CHROMEOS" ] |
| 34 | + } |
| 35 | + |
| 36 | ++ # Only target requires <atomic> |
| 37 | + if ((!(is_chromeos || chromeos_is_browser_only) || |
| 38 | + default_toolchain != "//build/toolchain/cros:target") && |
| 39 | ++ (current_toolchain != host_toolchain) && |
| 40 | + (!use_custom_libcxx || current_cpu == "mipsel")) { |
| 41 | + libs = [ "atomic" ] |
| 42 | + } |
| 43 | +-- |
| 44 | +2.18.2 |
| 45 | + |
0 commit comments