From 76ce1e741b1ecd5de7f04f87eca2120cdde77b39 Mon Sep 17 00:00:00 2001 From: sbc Date: Thu, 26 Nov 2015 08:41:15 -0800 Subject: [PATCH] Only build against prebuilt sysroot when using clang Its is not currently possible to use gcc with the sysroot since the sysroot only contains C++ headers for gcc 4.6 and gcc 4.8 is required to build chromium. Luckily clang is more flexible and able to detect and work with the 4.6 headers in the sysroot. BUG=504446 Review URL: https://codereview.chromium.org/1476923005 Cr-Original-Commit-Position: refs/heads/master@{#361905} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: ccc8c1e14c155255a8ef844704d97fa8e7d0dac2 --- common.gypi | 15 +++++++++------ config/sysroot.gni | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/common.gypi b/common.gypi index c5d5c85dd..54219d004 100644 --- a/common.gypi +++ b/common.gypi @@ -94,6 +94,12 @@ # if packaging for a linux distro) 'use_sysroot%': 1, + # Set this to true when building with Clang. + # See http://code.google.com/p/chromium/wiki/Clang for details. + # If this is set, clang is used as both host and target compiler in + # cross-compile builds. + 'clang%': 0, + # Override buildtype to select the desired build flavor. # Dev - everyday build for development/testing # Official - release build (generally implies additional processing) @@ -153,6 +159,7 @@ # Copy conditionally-set variables out one scope. 'chromeos%': '<(chromeos)', 'chromecast%': '<(chromecast)', + 'clang%': '<(clang)', 'desktop_linux%': '<(desktop_linux)', 'use_aura%': '<(use_aura)', 'use_ash%': '<(use_ash)', @@ -299,7 +306,7 @@ # Not used when chromecast=1 since ozone_platform_gbm doesn't # currently build against the linux sysroot # TODO(sbc): http://crbug.com/559708 - ['OS=="linux" and chromeos==0 and chromecast==0 and use_sysroot==1', { + ['OS=="linux" and chromeos==0 and chromecast==0 and clang==1 and use_sysroot==1', { # sysroot needs to be an absolute path otherwise it generates # incorrect results when passed to pkg-config 'conditions': [ @@ -325,6 +332,7 @@ # Copy conditionally-set variables out one scope. 'chromeos%': '<(chromeos)', 'chromecast%': '<(chromecast)', + 'clang%': '<(clang)', 'host_arch%': '<(host_arch)', 'target_arch%': '<(target_arch)', 'target_subarch%': '<(target_subarch)', @@ -622,11 +630,6 @@ # Clang stuff. 'make_clang_dir%': 'third_party/llvm-build/Release+Asserts', - # Set this to true when building with Clang. - # See http://code.google.com/p/chromium/wiki/Clang for details. - # If this is set, clang is used as both host and target compiler in - # cross-compile builds. - 'clang%': 0, # Use experimental lld linker instead of the platform's default linker. 'use_lld%': 0, diff --git a/config/sysroot.gni b/config/sysroot.gni index debf77129..98fa0937f 100644 --- a/config/sysroot.gni +++ b/config/sysroot.gni @@ -33,7 +33,7 @@ if (current_toolchain == default_toolchain && target_sysroot != "") { } else { sysroot = "" } -} else if (is_linux && !is_chromeos && use_sysroot) { +} else if (is_linux && !is_chromeos && is_clang && use_sysroot) { # By default build against a sysroot image downloaded from Cloud Storage # during gclient runhooks. if (current_cpu == "x64") {