1
Fork 0

recommend registering toolchains via .bazelrc

nix
Motiejus Jakštys 2022-02-08 14:09:30 +02:00
parent 424b1ca27d
commit 3325986971
3 changed files with 14 additions and 14 deletions

View File

@ -6,5 +6,9 @@ build --worker_sandboxing
build --compilation_mode=opt
build --incompatible_enable_cc_toolchain_resolution
build --extra_toolchains @zig_sdk//:linux_amd64_gnu.2.19_toolchain
build --extra_toolchains @zig_sdk//:linux_arm64_gnu.2.28_toolchain
build --extra_toolchains @zig_sdk//:darwin_amd64_toolchain
build --extra_toolchains @zig_sdk//:darwin_arm64_toolchain
#build --incompatible_use_cc_configure_from_rules_cc
#build --incompatible_use_platforms_repo_for_constraints

View File

@ -25,23 +25,26 @@ http_archive(
load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_toolchains")
zig_register_toolchains(register = [
"x86_64-linux-gnu.2.28",
"x86_64-macos-gnu",
])
zig_register_toolchains()
```
And this to `.bazelrc`:
```
build --incompatible_enable_cc_toolchain_resolution
build --extra_toolchains @zig_sdk//:linux_amd64_gnu.2.19_toolchain
build --extra_toolchains @zig_sdk//:linux_arm64_gnu.2.28_toolchain
build --extra_toolchains @zig_sdk//:darwin_amd64_toolchain
build --extra_toolchains @zig_sdk//:darwin_arm64_toolchain
```
The snippet above will download the zig toolchain and register it for the
The snippets above will download the zig toolchain and register it for the
following platforms:
- `x86_64-linux-gnu.2.28` for `["@platforms//os:linux", "@platforms//cpu:x86_64"]`.
- `x86_64-linux-gnu.2.19` for `["@platforms//os:linux", "@platforms//cpu:x86_64"]`.
- `x86_64-linux-gnu.2.28` for `["@platforms//os:linux", "@platforms//cpu:arm64"]`.
- `x86_64-macos-gnu` for `["@platforms//os:macos", "@platforms//cpu:x86_64"]`.
- `aarch64-macos-gnu` for `["@platforms//os:macos", "@platforms//cpu:arm64"]`.
Note that both Go and Bazel naming schemes are accepted. For convenience with
Go, the following Go-style toolchain aliases are created:

View File

@ -53,11 +53,4 @@ load(
zig_register_toolchains = "register_toolchains",
)
_REGISTER_TOOLCHAINS = [
"linux_arm64_gnu.2.28",
"linux_amd64_gnu.2.19",
"darwin_amd64",
"darwin_arm64",
]
zig_register_toolchains(register = _REGISTER_TOOLCHAINS)
zig_register_toolchains()