Skip to content

Support multiple copies of toolchain #231

@skeggse

Description

@skeggse

I need Zig 0.14 for some of my targets, and Zig 0.12 for other targets due to incompatibilities. Ideally, I'd just use Zig 0.14 for everything, but that's not possible yet.

I figured I might be able to just have two copies of the cc toolchain, and tried to set both up. Unfortunately, I'm running into the following error:

$ bazel test //:test
ERROR: /private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/hermetic_cc_toolchain_zig_0_14/toolchain/defs.bzl:251:13: An error occurred during the fetch of repository 'zig_config':
   Traceback (most recent call last):
	File "/private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/hermetic_cc_toolchain_zig_0_14/toolchain/defs.bzl", line 251, column 13, in _zig_repository_impl
		fail(zig_wrapper_err_msg)
Error in fail:
Compilation of zig-wrapper.zig failed:
command=ZIG_LOCAL_CACHE_DIR=/var/tmp/zig-cache ZIG_GLOBAL_CACHE_DIR=/var/tmp/zig-cache ../zig build-exe -target aarch64-macos-none -mcpu=apple_a14 -fstrip -OReleaseSafe zig-wrapper.zig
return_code=1
stderr=zig-wrapper.zig:96:32: error: root struct of file 'std' has no member named 'StaticStringMap'
/private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/zig_config/lib/std/std.zig:1:1: note: struct declared here

stdout=

You stumbled into a problem with Zig SDK that hermetic_cc_toolchain was not
able to fix. This is most likely a long-standing problem mostly (only?)
observed in OSX. Please please add a comment to
https://github.com/ziglang/zig/issues/18763 with:
- Output of `bazel run @zig_sdk//:zig version`
- Full output of this Bazel run, including the Bazel command.
- Full OS version and hardware revision (e.g. aarch64 or x86_64?).

Zig and hermetic_cc_toolchain maintainers aren't able to reproduce it, but you
are. Thus we need a bit of your collaboration to get to the bottom of it.

After commenting on the issue, `rm -fr /var/tmp/zig-cache` and re-run your command.
ERROR: no such package '@@zig_config//':
Compilation of zig-wrapper.zig failed:
command=ZIG_LOCAL_CACHE_DIR=/var/tmp/zig-cache ZIG_GLOBAL_CACHE_DIR=/var/tmp/zig-cache ../zig build-exe -target aarch64-macos-none -mcpu=apple_a14 -fstrip -OReleaseSafe zig-wrapper.zig
return_code=1
stderr=zig-wrapper.zig:96:32: error: root struct of file 'std' has no member named 'StaticStringMap'
/private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/zig_config/lib/std/std.zig:1:1: note: struct declared here

stdout=

You stumbled into a problem with Zig SDK that hermetic_cc_toolchain was not
able to fix. This is most likely a long-standing problem mostly (only?)
observed in OSX. Please please add a comment to
https://github.com/ziglang/zig/issues/18763 with:
- Output of `bazel run @zig_sdk//:zig version`
- Full output of this Bazel run, including the Bazel command.
- Full OS version and hardware revision (e.g. aarch64 or x86_64?).

Zig and hermetic_cc_toolchain maintainers aren't able to reproduce it, but you
are. Thus we need a bit of your collaboration to get to the bottom of it.

After commenting on the issue, `rm -fr /var/tmp/zig-cache` and re-run your command.
ERROR: /private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/zig_sdk/toolchain/BUILD:7:19: @@zig_sdk//toolchain:linux_amd64_gnu.2.31 depends on @@zig_config//:exec_cpu in repository @@zig_config which failed to fetch. no such package '@@zig_config//':
Compilation of zig-wrapper.zig failed:
command=ZIG_LOCAL_CACHE_DIR=/var/tmp/zig-cache ZIG_GLOBAL_CACHE_DIR=/var/tmp/zig-cache ../zig build-exe -target aarch64-macos-none -mcpu=apple_a14 -fstrip -OReleaseSafe zig-wrapper.zig
return_code=1
stderr=zig-wrapper.zig:96:32: error: root struct of file 'std' has no member named 'StaticStringMap'
/private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/zig_config/lib/std/std.zig:1:1: note: struct declared here

stdout=

You stumbled into a problem with Zig SDK that hermetic_cc_toolchain was not
able to fix. This is most likely a long-standing problem mostly (only?)
observed in OSX. Please please add a comment to
https://github.com/ziglang/zig/issues/18763 with:
- Output of `bazel run @zig_sdk//:zig version`
- Full output of this Bazel run, including the Bazel command.
- Full OS version and hardware revision (e.g. aarch64 or x86_64?).

Zig and hermetic_cc_toolchain maintainers aren't able to reproduce it, but you
are. Thus we need a bit of your collaboration to get to the bottom of it.

After commenting on the issue, `rm -fr /var/tmp/zig-cache` and re-run your command.

Output of bazel run @zig_sdk//:zig version:

DEBUG: /private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/hermetic_cc_toolchain_zig_0_14/toolchain/defs.bzl:228:18: Launcher compilation failed. Retrying build
DEBUG: /private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/hermetic_cc_toolchain_zig_0_14/toolchain/defs.bzl:228:18: Launcher compilation failed. Retrying build
INFO: Repository zig_config instantiated at:
  /Users/eliskeggs/src/bazel-aws-lc-repro/WORKSPACE:110:20: in <toplevel>
  /private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/hermetic_cc_toolchain_zig_0_14/toolchain/defs.bzl:90:19: in toolchains
Repository rule zig_repository defined at:
  /private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/hermetic_cc_toolchain_zig_0_14/toolchain/defs.bzl:273:33: in <toplevel>
INFO: repository @@zig_config' used the following cache hits instead of downloading the corresponding file.
 * Hash '294e224c14fd0822cfb15a35cf39aa14bd9967867999bf8bdfe3db7ddec2a27f' for https://mirror.bazel.build/ziglang.org/download/0.12.0/zig-macos-aarch64-0.12.0.tar.xz
If the definition of 'repository @@zig_config' was updated, verify that the hashes were also updated.
ERROR: /private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/hermetic_cc_toolchain_zig_0_14/toolchain/defs.bzl:251:13: An error occurred during the fetch of repository 'zig_config':
   Traceback (most recent call last):
	File "/private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/hermetic_cc_toolchain_zig_0_14/toolchain/defs.bzl", line 251, column 13, in _zig_repository_impl
		fail(zig_wrapper_err_msg)
Error in fail:
Compilation of zig-wrapper.zig failed:
command=ZIG_LOCAL_CACHE_DIR=/var/tmp/zig-cache ZIG_GLOBAL_CACHE_DIR=/var/tmp/zig-cache ../zig build-exe -target aarch64-macos-none -mcpu=apple_a14 -fstrip -OReleaseSafe zig-wrapper.zig
return_code=1
stderr=zig-wrapper.zig:96:32: error: root struct of file 'std' has no member named 'StaticStringMap'
/private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/zig_config/lib/std/std.zig:1:1: note: struct declared here

stdout=

You stumbled into a problem with Zig SDK that hermetic_cc_toolchain was not
able to fix. This is most likely a long-standing problem mostly (only?)
observed in OSX. Please please add a comment to
https://github.com/ziglang/zig/issues/18763 with:
- Output of `bazel run @zig_sdk//:zig version`
- Full output of this Bazel run, including the Bazel command.
- Full OS version and hardware revision (e.g. aarch64 or x86_64?).

Zig and hermetic_cc_toolchain maintainers aren't able to reproduce it, but you
are. Thus we need a bit of your collaboration to get to the bottom of it.

After commenting on the issue, `rm -fr /var/tmp/zig-cache` and re-run your command.
ERROR: no such package '@@zig_config//':
Compilation of zig-wrapper.zig failed:
command=ZIG_LOCAL_CACHE_DIR=/var/tmp/zig-cache ZIG_GLOBAL_CACHE_DIR=/var/tmp/zig-cache ../zig build-exe -target aarch64-macos-none -mcpu=apple_a14 -fstrip -OReleaseSafe zig-wrapper.zig
return_code=1
stderr=zig-wrapper.zig:96:32: error: root struct of file 'std' has no member named 'StaticStringMap'
/private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/zig_config/lib/std/std.zig:1:1: note: struct declared here

stdout=

You stumbled into a problem with Zig SDK that hermetic_cc_toolchain was not
able to fix. This is most likely a long-standing problem mostly (only?)
observed in OSX. Please please add a comment to
https://github.com/ziglang/zig/issues/18763 with:
- Output of `bazel run @zig_sdk//:zig version`
- Full output of this Bazel run, including the Bazel command.
- Full OS version and hardware revision (e.g. aarch64 or x86_64?).

Zig and hermetic_cc_toolchain maintainers aren't able to reproduce it, but you
are. Thus we need a bit of your collaboration to get to the bottom of it.

After commenting on the issue, `rm -fr /var/tmp/zig-cache` and re-run your command.
ERROR: /private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/zig_sdk/BUILD.bazel:6:6: @@zig_sdk//:zig depends on @@zig_config//:zig in repository @@zig_config which failed to fetch. no such package '@@zig_config//':
Compilation of zig-wrapper.zig failed:
command=ZIG_LOCAL_CACHE_DIR=/var/tmp/zig-cache ZIG_GLOBAL_CACHE_DIR=/var/tmp/zig-cache ../zig build-exe -target aarch64-macos-none -mcpu=apple_a14 -fstrip -OReleaseSafe zig-wrapper.zig
return_code=1
stderr=zig-wrapper.zig:96:32: error: root struct of file 'std' has no member named 'StaticStringMap'
/private/var/tmp/_bazel_eliskeggs/e580cc93b7a734e8234364ad5cffaba6/external/zig_config/lib/std/std.zig:1:1: note: struct declared here

stdout=

You stumbled into a problem with Zig SDK that hermetic_cc_toolchain was not
able to fix. This is most likely a long-standing problem mostly (only?)
observed in OSX. Please please add a comment to
https://github.com/ziglang/zig/issues/18763 with:
- Output of `bazel run @zig_sdk//:zig version`
- Full output of this Bazel run, including the Bazel command.
- Full OS version and hardware revision (e.g. aarch64 or x86_64?).

Zig and hermetic_cc_toolchain maintainers aren't able to reproduce it, but you
are. Thus we need a bit of your collaboration to get to the bottom of it.

After commenting on the issue, `rm -fr /var/tmp/zig-cache` and re-run your command.
ERROR: Analysis of target '@@zig_sdk//:zig' failed; build aborted: Analysis failed
INFO: Elapsed time: 13.927s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

Running macOS 15.7 (24G222), aarch64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions