Skip to content

Commit 54d116c

Browse files
hongxu-jiaRaphael Kubo da Costa
authored andcommitted
chromium: 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 by (current_toolchain != host_toolchain) Fixes #431 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com>
1 parent e940c1c commit 54d116c

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

recipes-browser/chromium/chromium-gn.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ SRC_URI += " \
2424
file://0001-IWYU-add-missing-include-for-std-vector-and-std-uniq.patch \
2525
file://0001-ozone-fix-include.patch \
2626
file://0001-Fix-ill-formed-C-code.patch \
27+
file://0001-link-atomic-for-target-only.patch \
2728
"
2829

2930
SRC_URI_append_libc-musl = "\
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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

Comments
 (0)