diff --git a/MODULE.bazel b/MODULE.bazel index 61572c8..6211391 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -6,7 +6,6 @@ bazel_dep(name = "abseil-cpp", version = "20240722.0.bcr.2") bazel_dep(name = "aspect_bazel_lib", version = "2.14.0") bazel_dep(name = "aspect_rules_py", version = "1.3.2") bazel_dep(name = "bazel_skylib", version = "1.7.1") -bazel_dep(name = "hermetic_cc_toolchain", version = "3.2.0") bazel_dep(name = "libxev", version = "20250313.0-5773f46") bazel_dep(name = "patchelf", version = "0.18.0") bazel_dep(name = "pcre2", version = "10.43") @@ -18,8 +17,9 @@ bazel_dep(name = "rules_proto", version = "7.1.0") bazel_dep(name = "rules_python", version = "0.40.0") bazel_dep(name = "rules_rust", version = "0.60.0") bazel_dep(name = "rules_uv", version = "0.65.0") -bazel_dep(name = "rules_zig", version = "20250519.0-233b207") +bazel_dep(name = "rules_zig", version = "20250530.0-5084f1f") bazel_dep(name = "sentencepiece", version = "20240618.0-d7ace0a") +bazel_dep(name = "toolchains_llvm_bootstrapped", version = "0.2.3") bazel_dep(name = "toolchains_protoc", version = "0.4.1") bazel_dep(name = "with_cfg.bzl", version = "0.9.1") bazel_dep(name = "xla", version = "20250527.0-cb67f2f") @@ -54,12 +54,9 @@ register_toolchains("@rules_zig//zig/target:all") register_toolchains("@zig_toolchains//:all") -toolchains = use_extension("@hermetic_cc_toolchain//toolchain:ext.bzl", "toolchains") -use_repo(toolchains, "zig_sdk", "zig_sdk-linux-amd64", "zig_sdk-linux-arm64", "zig_sdk-macos-amd64", "zig_sdk-macos-arm64", "zig_sdk-windows-amd64") - register_toolchains( - "@zig_sdk//toolchain:linux_amd64_gnu.2.31", - "@zig_sdk//toolchain:linux_arm64_gnu.2.31", + "@toolchains_llvm_bootstrapped//toolchain:linux_amd64", + "@toolchains_llvm_bootstrapped//toolchain:linux_aarch64", ) python = use_extension("@rules_python//python/extensions:python.bzl", "python") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 3132fc1..53abb72 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -56,7 +56,6 @@ "https://bazel-registry.zml.ai/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/googletest/1.14.0/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/googletest/1.15.2/MODULE.bazel": "not found", - "https://bazel-registry.zml.ai/modules/hermetic_cc_toolchain/3.2.0/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/jsoncpp/1.9.5/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/libpfm/4.11.0/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/nlohmann_json/3.6.1/MODULE.bazel": "not found", @@ -169,10 +168,12 @@ "https://bazel-registry.zml.ai/modules/stardoc/0.7.1/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/stardoc/0.7.2/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/swift_argument_parser/1.3.1.1/MODULE.bazel": "not found", + "https://bazel-registry.zml.ai/modules/toolchains_llvm_bootstrapped/0.2.3/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/toolchains_protoc/0.4.1/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/upb/0.0.0-20230516-61a97ef/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/with_cfg.bzl/0.9.1/MODULE.bazel": "not found", + "https://bazel-registry.zml.ai/modules/with_cfg.bzl/0.9.2/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/zlib/1.2.11/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/zlib/1.2.13/MODULE.bazel": "not found", "https://bazel-registry.zml.ai/modules/zlib/1.3.1.bcr.3/MODULE.bazel": "not found", @@ -242,8 +243,6 @@ "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f", "https://bcr.bazel.build/modules/googletest/1.15.2/MODULE.bazel": "6de1edc1d26cafb0ea1a6ab3f4d4192d91a312fd2d360b63adaa213cd00b2108", "https://bcr.bazel.build/modules/googletest/1.15.2/source.json": "dbdda654dcb3a0d7a8bc5d0ac5fc7e150b58c2a986025ae5bc634bb2cb61f470", - "https://bcr.bazel.build/modules/hermetic_cc_toolchain/3.2.0/MODULE.bazel": "8e7faec81c1f0fb65fe277ecfc75ea3636ce7bf848f88037fedd58e6eeacc28f", - "https://bcr.bazel.build/modules/hermetic_cc_toolchain/3.2.0/source.json": "67c2b76edff27c3ec449a935fc9468996d1a730b52a9a6f97c40c8a06d381630", "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075", "https://bcr.bazel.build/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d", "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902", @@ -383,12 +382,15 @@ "https://bcr.bazel.build/modules/stardoc/0.7.2/source.json": "58b029e5e901d6802967754adf0a9056747e8176f017cfe3607c0851f4d42216", "https://bcr.bazel.build/modules/swift_argument_parser/1.3.1.1/MODULE.bazel": "5e463fbfba7b1701d957555ed45097d7f984211330106ccd1352c6e0af0dcf91", "https://bcr.bazel.build/modules/swift_argument_parser/1.3.1.1/source.json": "32bd87e5f4d7acc57c5b2ff7c325ae3061d5e242c0c4c214ae87e0f1c13e54cb", + "https://bcr.bazel.build/modules/toolchains_llvm_bootstrapped/0.2.3/MODULE.bazel": "d367f0e4eb3045ca1245dd59013922b0e82e6d2588c83d4a5691404b23ff305e", + "https://bcr.bazel.build/modules/toolchains_llvm_bootstrapped/0.2.3/source.json": "b2ea90900a6398c5d3225bd05b99b7032c7bf6e10d228c7260c7d9720be416f1", "https://bcr.bazel.build/modules/toolchains_protoc/0.4.1/MODULE.bazel": "05d6c16474a7a96002dd5512c444aa6965ebcf95f3e0c47001aa18269fbecec9", "https://bcr.bazel.build/modules/toolchains_protoc/0.4.1/source.json": "474d926c8e845762faaa42e792fc66cd36794daee4c8af900f673fad0b403a8d", "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", "https://bcr.bazel.build/modules/upb/0.0.0-20230516-61a97ef/MODULE.bazel": "c0df5e35ad55e264160417fd0875932ee3c9dda63d9fccace35ac62f45e1b6f9", "https://bcr.bazel.build/modules/with_cfg.bzl/0.9.1/MODULE.bazel": "5b880a01ab5b3bdb30931075d6b8e58075f999400f7a544632dc7b4a575b3c1e", - "https://bcr.bazel.build/modules/with_cfg.bzl/0.9.1/source.json": "c7a183da2500942aeabf32a576ede2c413aa08b6b3bb823a16a623333c061cf9", + "https://bcr.bazel.build/modules/with_cfg.bzl/0.9.2/MODULE.bazel": "8008021cb802e87e22b3e2b6f403c0529d4b865703fdcd40e2f36c23a651291c", + "https://bcr.bazel.build/modules/with_cfg.bzl/0.9.2/source.json": "06d276bd336d6c9f069d4a68729de4e5d322129665f871c2b328a14b26b7cd99", "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", "https://bcr.bazel.build/modules/zlib/1.2.13/MODULE.bazel": "aa6deb1b83c18ffecd940c4119aff9567cd0a671d7bba756741cb2ef043a29d5", "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.3/MODULE.bazel": "af322bc08976524477c79d1e45e241b6efbeb918c497e8840b8ab116802dda79", diff --git a/bazel/zig.bzl b/bazel/zig.bzl index fc84ef5..26773a5 100644 --- a/bazel/zig.bzl +++ b/bazel/zig.bzl @@ -15,7 +15,7 @@ def zig_cc_binary( zig_binary( name = "{}_lib".format(name), kind = BINARY_KIND.static_lib, - copts = copts + ["-lc", "-fcompiler-rt"], + copts = copts + ["-lc"], deps = deps, visibility = visibility, **kwargs @@ -45,7 +45,7 @@ def zig_cc_test( kind = BINARY_KIND.test_lib, test_runner = test_runner, tags = tags, - copts = copts + ["-lc", "-fcompiler-rt"], + copts = copts + ["-lc"], deps = deps + [ "@rules_zig//zig/lib:libc", ], diff --git a/platforms/BUILD.bazel b/platforms/BUILD.bazel index 45fddc0..57756f4 100644 --- a/platforms/BUILD.bazel +++ b/platforms/BUILD.bazel @@ -1,8 +1,33 @@ +alias( + name = "host", + actual = select({ + "@platforms//os:linux": ":host_linux", + "//conditions:default": ":host_other", + }), +) + +platform( + name = "host_other", + parents = ["@platforms//host"], + visibility = ["//visibility:public"], +) + + +platform( + name = "host_linux", + parents = ["@platforms//host"], + constraint_values = [ + "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.31", + ], + visibility = ["//visibility:public"], +) + platform( name = "linux_amd64", constraint_values = [ "@platforms//cpu:x86_64", "@platforms//os:linux", + "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.31", ], visibility = ["//visibility:public"], ) @@ -12,6 +37,7 @@ platform( constraint_values = [ "@platforms//cpu:aarch64", "@platforms//os:linux", + "@toolchains_llvm_bootstrapped//constraints/libc:gnu.2.31", ], visibility = ["//visibility:public"], ) diff --git a/third_party/modules/rules_zig/20250530.0-5084f1f/MODULE.bazel b/third_party/modules/rules_zig/20250530.0-5084f1f/MODULE.bazel new file mode 100644 index 0000000..06b1e94 --- /dev/null +++ b/third_party/modules/rules_zig/20250530.0-5084f1f/MODULE.bazel @@ -0,0 +1,68 @@ +module( + name = "rules_zig", + version = "20250530.0-5084f1f", + compatibility_level = 1, +) + +bazel_dep(name = "aspect_bazel_lib", version = "2.8.1") +bazel_dep(name = "bazel_skylib", version = "1.7.1") +bazel_dep(name = "platforms", version = "0.0.10") + +zig = use_extension("//zig:extensions.bzl", "zig") +zig.index(file = "//zig/private:versions.json") +use_repo(zig, "zig_toolchains") + +register_toolchains("@rules_zig//zig/target:all") + +register_toolchains("@zig_toolchains//:all") + +zig_dev = use_extension( + "//zig:extensions.bzl", + "zig", + dev_dependency = True, +) +zig_dev.toolchain(zig_version = "0.13.0") +zig_dev.toolchain(zig_version = "0.12.1") +zig_dev.toolchain(zig_version = "0.12.0") +zig_dev.toolchain(zig_version = "0.11.0") + +bazel_dep(name = "rules_cc", version = "0.0.9") +bazel_dep(name = "stardoc", version = "0.7.0", dev_dependency = True, repo_name = "io_bazel_stardoc") +bazel_dep(name = "gazelle", version = "0.38.0", dev_dependency = True, repo_name = "bazel_gazelle") +bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True) +bazel_dep( + name = "buildifier_prebuilt", + version = "7.3.1", + dev_dependency = True, +) +bazel_dep(name = "rules_multirun", version = "0.9.0", dev_dependency = True) +bazel_dep(name = "rules_python", version = "0.35.0", dev_dependency = True) +bazel_dep( + name = "rules_bazel_integration_test", + version = "0.25.0", + dev_dependency = True, +) + +bazel_binaries = use_extension( + "@rules_bazel_integration_test//:extensions.bzl", + "bazel_binaries", + dev_dependency = True, +) + +# NOTE: Keep in sync with WORKSPACE. +bazel_binaries.download(version_file = "//:.bazelversion") +bazel_binaries.download(version = "7.0.0") +use_repo( + bazel_binaries, + "bazel_binaries", + "bazel_binaries_bazelisk", + "build_bazel_bazel_.bazelversion", + "build_bazel_bazel_7_0_0", +) + +# TODO[AH] Should be an implicit transitive dependency through rules_bazel_integration_test. +# However, if we do not include it explicitly, then the runfiles resolution for +# cgrindel_bazel_starlib/shlib/lib/message.sh fails in +# rules_bazel_integration_test/tools/update_deleted_packages.sh when invoked +# through the rules_multirun target //util:update. +bazel_dep(name = "cgrindel_bazel_starlib", version = "0.21.0", dev_dependency = True) diff --git a/third_party/modules/rules_zig/20250530.0-5084f1f/source.json b/third_party/modules/rules_zig/20250530.0-5084f1f/source.json new file mode 100644 index 0000000..081142c --- /dev/null +++ b/third_party/modules/rules_zig/20250530.0-5084f1f/source.json @@ -0,0 +1,5 @@ +{ + "strip_prefix": "rules_zig-5084f1f3a151dfc697900274c19813a4260217c6", + "url": "https://github.com/zml/rules_zig/archive/5084f1f3a151dfc697900274c19813a4260217c6.tar.gz", + "integrity": "sha256-KpZkIDnKG0sXtRhsE0SDoj3QeeHRKQCRjm6LzxmueRA=" +}