diff options
author | Janak Ramakrishnan <janakr@google.com> | 2015-04-07 19:08:33 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2015-04-08 08:46:47 +0000 |
commit | e1cdad54cc0ca3a4af13d3d6b1e6ad0102235360 (patch) | |
tree | d3d7da5eee5098494f3cb112bd639ffd5bc56a68 /src/main/java/com/google/devtools/build/lib/rules | |
parent | a66a8f736f860bacf76586c0960521058876ed74 (diff) |
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
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java | 9 |
1 files changed, 6 insertions, 3 deletions
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); |