perfetto: fix compile on CI debug
The libstdc++ bundled in buster-backports really does not seem to get
along with the system clang-8 used on debug bots. Fix the issue by
instead using libc++ on the bot (which we newly install).
libstdc++ is still covered by the GCC bot: the clang + libstdc++
combo wasn't covered anyway before aosp/2281848 landed.
Change-Id: I6f9d752f38cdbdec06b89ce59809afce9b41647d
diff --git a/docs/contributing/build-instructions.md b/docs/contributing/build-instructions.md
index 878a003..9de4f74 100644
--- a/docs/contributing/build-instructions.md
+++ b/docs/contributing/build-instructions.md
@@ -326,6 +326,12 @@
Use bundled toolchain from `buildtools/` rather than system-wide one.
+`non_hermetic_clang_stdlib = libc++ | libstdc++`
+
+If `is_hermetic_clang` is `false`, sets the `-stdlib` flag for clang
+invocations. `libstdc++` is default on Linux hosts and `libc++` is
+default everywhere else.
+
`cc = "gcc" / cxx = "g++"`
Uses a different compiler binary (default: autodetected depending on is_clang).
diff --git a/gn/standalone/BUILD.gn b/gn/standalone/BUILD.gn
index 52da358..0d17328 100644
--- a/gn/standalone/BUILD.gn
+++ b/gn/standalone/BUILD.gn
@@ -237,6 +237,11 @@
not_needed([ "hermetic_clang_suppressions" ])
}
+ if (is_clang && !is_hermetic_clang && !is_wasm) {
+ cflags_cc += [ "-stdlib=" + non_hermetic_clang_stdlib ]
+ ldflags += [ "-stdlib=" + non_hermetic_clang_stdlib ]
+ }
+
if (is_lto) {
cflags += [ "-flto=full" ]
ldflags += [ "-flto=full" ]
diff --git a/gn/standalone/toolchain/llvm.gni b/gn/standalone/toolchain/llvm.gni
index 75bc5ff..3726411 100644
--- a/gn/standalone/toolchain/llvm.gni
+++ b/gn/standalone/toolchain/llvm.gni
@@ -16,6 +16,11 @@
declare_args() {
is_hermetic_clang = is_clang && (is_linux_host || is_win_host)
+ if (is_linux_host) {
+ non_hermetic_clang_stdlib = "libstdc++"
+ } else {
+ non_hermetic_clang_stdlib = "libc++"
+ }
}
assert(!is_hermetic_clang || is_clang, "is_hermetic_clang requires is_clang")
diff --git a/infra/ci/config.py b/infra/ci/config.py
index 9c56f8b..ba8bf93 100755
--- a/infra/ci/config.py
+++ b/infra/ci/config.py
@@ -66,8 +66,10 @@
# Only variables starting with PERFETTO_ are propagated into the sandbox.
JOB_CONFIGS = {
'linux-clang-x86_64-debug': {
- 'PERFETTO_TEST_GN_ARGS': 'is_debug=true is_hermetic_clang=false',
- 'PERFETTO_TEST_SCRIPT': 'test/ci/linux_tests.sh',
+ 'PERFETTO_TEST_GN_ARGS':
+ 'is_debug=true is_hermetic_clang=false non_hermetic_clang_stdlib="libc++"',
+ 'PERFETTO_TEST_SCRIPT':
+ 'test/ci/linux_tests.sh',
},
'linux-clang-x86_64-tsan': {
'PERFETTO_TEST_GN_ARGS': 'is_debug=false is_tsan=true',
diff --git a/infra/ci/sandbox/Dockerfile b/infra/ci/sandbox/Dockerfile
index 79da8d4..ebd5539 100644
--- a/infra/ci/sandbox/Dockerfile
+++ b/infra/ci/sandbox/Dockerfile
@@ -26,7 +26,8 @@
apt-get -y install python3 python3-pip git curl sudo lz4 tar ccache tini \
libpulse0 libgl1 libxml2 libc6-dev-i386 libtinfo5 \
gnupg2 pkg-config zip g++ zlib1g-dev unzip \
- python3-distutils clang-8 gcc-7 g++-7; \
+ python3-distutils gcc-7 g++-7; \
+ apt-get -y install libc++-8-dev libc++abi-8-dev clang-8; \
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1; \
gcc-7 --version; \
g++-7 --version; \