aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java9
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);