Skip to content

Commit

Permalink
Achieve perfect reproducibility for Linux Bazel builds
Browse files Browse the repository at this point in the history
Close the final nonhermeticity by reconfiguring rules_python to use a
statically linked musl toolchain. This makes nativelink fully buildable
and testable with lre-rs in remote execution with perfect parity to
local execution.
  • Loading branch information
aaronmondal committed Dec 14, 2024
1 parent 5e07ce4 commit 0d27887
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ common --enable_platform_specific_config
common --incompatible_enable_cc_toolchain_resolution
common --incompatible_enable_proto_toolchain_resolution

# Simulate rules_python's initialization with a script and use a statically
# linked musl Python toolchain.
# TODO(aaronmondal): This is a hack. It works for us because have just a few
# simple python scripts in the repository and don't have
# complex Python dependencies. Implement LRE for Python.
common --@rules_python//python/config_settings:bootstrap_impl=script
common --@rules_python//python/config_settings:py_linux_libc=musl

# Don't leak PATH and LD_LIBRARY_PATH into the build.
build --incompatible_strict_action_env

Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module(

bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_python", version = "0.40.0")
bazel_dep(name = "rules_python", version = "1.0.0")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
Expand Down
1 change: 1 addition & 0 deletions nativelink-proto/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
load(
"@rules_rust//rust:defs.bzl",
"rust_binary",
Expand Down

0 comments on commit 0d27887

Please sign in to comment.