xla: add aarch64-darwin support (#492814)

This commit is contained in:
Samuel Ainsworth
2026-03-02 23:56:36 +00:00
committed by GitHub
2 changed files with 31 additions and 21 deletions
@@ -10,9 +10,9 @@ index 53e6494656..22261cd268 100644
import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
@@ -193,16 +194,11 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
@@ -193,16 +194,15 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
}
if (shouldUseCachedRepos(env, handler, repoRoot, rule)) {
- // Make sure marker file is up-to-date; correctly describes the current repository state
- byte[] markerHash = digestWriter.areRepositoryAndMarkerFileConsistent(handler, env);
@@ -20,8 +20,12 @@ index 53e6494656..22261cd268 100644
- return null;
- }
- if (markerHash != null) { // repo exist & up-to-date
+ {
+ // Nix hack: Always consider cached dirs as up-to-date
+ // Nix hack: Skip marker file validation but only for repos that have
+ // been fully initialized. Check for common root files that indicate a
+ // real repo, not an empty dir created by module extensions before the
+ // repository rule has had a chance to run.
+ if (repoRoot.getChild("BUILD").exists() || repoRoot.getChild("BUILD.bazel").exists()
+ || repoRoot.getChild("WORKSPACE").exists() || repoRoot.getChild("WORKSPACE.bazel").exists()) {
return RepositoryDirectoryValue.builder()
.setPath(repoRoot)
- .setDigest(markerHash)
@@ -30,8 +34,6 @@ index 53e6494656..22261cd268 100644
.build();
}
}
diff --git a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
index 649647c5f2..64d05b530c 100644
--- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
@@ -43,4 +45,4 @@ index 649647c5f2..64d05b530c 100644
- builder.environment().clear();
builder.environment().putAll(params.getEnv());
}
+22 -14
View File
@@ -1,6 +1,7 @@
{
bazel_7,
buildBazelPackage,
cctools,
curl,
double-conversion,
fetchFromGitHub,
@@ -18,6 +19,7 @@
python3,
snappy,
sqlite,
stdenv,
which,
zlib,
}:
@@ -71,7 +73,8 @@ in
gitMinimal
pythonEnv # necessary for some patchShebang'ing
which
];
]
++ lib.optional stdenv.hostPlatform.isDarwin cctools.libtool;
buildInputs = [
curl
@@ -136,6 +139,14 @@ in
"--host_cxxopt=cstdint"
# Exclude mobile/iOS targets that have Bazel incompatibilities
"--build_tag_filters=-mobile,-ios"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Set macOS deployment target to suppress availability errors (e.g.
# futimens requires 10.13+) in both target and host-tool builds.
"--copt=-mmacosx-version-min=11.0"
"--host_copt=-mmacosx-version-min=11.0"
"--linkopt=-mmacosx-version-min=11.0"
"--host_linkopt=-mmacosx-version-min=11.0"
];
removeRulesCC = false;
@@ -146,10 +157,16 @@ in
removeLocal = false;
fetchAttrs = {
sha256 = "sha256-OJfSqDlEC+yhWwwMwaD5HGvuHm8OWk+yQxmbH0/gZ88=";
sha256 =
{
x86_64-linux = "sha256-OJfSqDlEC+yhWwwMwaD5HGvuHm8OWk+yQxmbH0/gZ88=";
aarch64-darwin = "sha256-sKxtdgozCV1on1gd+bm8FKyFxP0u70Hs24OdLNA3jh0=";
}
.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}");
preInstall = ''
rm -rf $bazelOut/external/{local_config_python,\@local_config_python.marker}
rm -rf $bazelOut/external/{local_config_sh,\@local_config_sh.marker}
rm -rf $bazelOut/external/{local_config_xcode,\@local_config_xcode.marker}
rm -rf $bazelOut/external/{local_execution_config_python,\@local_execution_config_python.marker}
rm -rf $bazelOut/external/{local_jdk,\@local_jdk.marker}
'';
@@ -187,18 +204,9 @@ in
homepage = "https://github.com/openxla/xla";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ samuela ];
platforms = lib.platforms.unix;
badPlatforms = [
# ERROR: /build/output/external/local_config_cc/BUILD: no such target
# '@@local_config_cc//:cc-compiler-k8': target 'cc-compiler-k8' not declared in package ''
# defined by /build/output/external/local_config_cc/BUILD
"aarch64-linux"
# Bazel fails to build on darwin:
# ERROR: no such package '@@bazel_tools~xcode_configure_extension~local_config_xcode//':
# BUILD file not found in directory '' of external repository @@bazel_tools~xcode_configure_extension~local_config_xcode.
# Add a BUILD file to a directory to mark it as a package.
lib.systems.inspect.patterns.isDarwin
platforms = [
"x86_64-linux"
"aarch64-darwin"
];
};
}