From e1cdad54cc0ca3a4af13d3d6b1e6ad0102235360 Mon Sep 17 00:00:00 2001 From: Janak Ramakrishnan Date: Tue, 7 Apr 2015 19:08:33 +0000 Subject: Fix build failure when using older crosstool that doesn't have stdc-predef.h. We used to unconditionally add this file, but that doesn't make sense for crosstools that don't have it. Long-term, we need to get the name of this file from the CROSSTOOL file. I was unable to test this because getting all of an older crosstool's dependencies into a test was too hard. But I manually verified that it works. -- MOS_MIGRATED_REVID=90533610 --- .../google/devtools/build/lib/rules/cpp/CppConfiguration.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java') diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java index b3cdf3b82b..9031b721c2 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java @@ -1749,9 +1749,12 @@ public class CppConfiguration extends BuildConfiguration.Fragment { if (getSysroot() != null && !getSysroot().isAbsolute()) { Root sysrootRoot = Iterables.getOnlyElement( resolver.findPackageRoots(ImmutableList.of(getSysroot())).entrySet()).getValue(); - builtInIncludeFile = Preconditions.checkNotNull(artifactFactory.getSourceArtifact( - sysroot.getRelative(BUILT_IN_INCLUDE_PATH_FRAGMENT), sysrootRoot), - "%s %s", sysrootRoot, sysroot); + PathFragment sysrootExecPath = sysroot.getRelative(BUILT_IN_INCLUDE_PATH_FRAGMENT); + if (sysrootRoot.getPath().getRelative(sysrootExecPath).exists()) { + builtInIncludeFile = Preconditions.checkNotNull( + artifactFactory.getSourceArtifact(sysrootExecPath, sysrootRoot), + "%s %s", sysrootRoot, sysroot); + } } try { getFdoSupport().prepareToBuild(execRoot, genfilesPath, artifactFactory, resolver); -- cgit v1.2.3