Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zig fetching errors in bazel after upgrading Mac #13130

Closed
james-prysm opened this issue Oct 27, 2023 · 1 comment · Fixed by #13142
Closed

Zig fetching errors in bazel after upgrading Mac #13130

james-prysm opened this issue Oct 27, 2023 · 1 comment · Fixed by #13142
Assignees
Labels
Bug Something isn't working Tools Tools related tasks

Comments

@james-prysm
Copy link
Contributor

james-prysm commented Oct 27, 2023

Describe the bug

After upgrading to Sonoma 14.1 bazel tries to fetch a new version of zig without updating the sha256

Zig should be disabled for mac arm but still tries to pull it anyway.
a work around is replacing line 30 on the WORKSPACE file zig_toolchain

_HOST_PLATFORM_SHA256 = {
    "linux-aarch64": "956eb095d8ba44ac6ebd27f7c9956e47d92937c103bf754745d0a39cdaa5d4c6",
    "linux-x86_64": "3607099807dca909935fb9249c16f4bfed6e58872ec1a7fc1eb65776d6d32111",  # Updated
    "macos-aarch64": "5edd4f9e88eb6864f1818ecf81d2d489cb10845a4e84e6ebcee06566b205e769",  # Updated
    "macos-x86_64": "1c1c6b9a906b42baae73656e24e108fd8444bb50b6e8fd03e9e7a3f8b5f05686",
    "windows-x86_64": "142caa3b804d86b4752556c9b6b039b7517a08afa3af842645c7e2dcd125f652",
}

zig_toolchains(
    host_platform_sha256 = _HOST_PLATFORM_SHA256,
    version = "0.12.0-dev.1298+da06269d7",
)

note: the sha can update and should replaced every 90 days

Has this worked before in a previous version?

No response

🔬 Minimal Reproduction

  1. run mac m1
  2. run a bazel command like bazel run //:gazelle -- fix

Error

DEBUG: /private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/hermetic_cc_toolchain/toolchain/defs.bzl:182:18: Launcher compilation failed. Retrying build
DEBUG: /private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/hermetic_cc_toolchain/toolchain/defs.bzl:182:18: Launcher compilation failed. Retrying build
INFO: Repository zig_sdk instantiated at:
  /Users/james/Documents/Prysm/git/prysm/WORKSPACE:30:15: in <toplevel>
  /private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/hermetic_cc_toolchain/toolchain/defs.bzl:80:19: in toolchains
Repository rule zig_repository defined at:
  /private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/hermetic_cc_toolchain/toolchain/defs.bzl:218:33: in <toplevel>
INFO: repository @zig_sdk' used the following cache hits instead of downloading the corresponding file.
 * Hash '19f9115410a6dfb004c65d63ffecf947efc595d08977906f73a90d7b2de0b3dc' for https://mirror.bazel.build/ziglang.org/builds/zig-macos-aarch64-0.11.0-dev.3312+ab37ab33c.tar.xz
If the definition of 'repository @zig_sdk' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'zig_sdk':
   Traceback (most recent call last):
        File "/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/hermetic_cc_toolchain/toolchain/defs.bzl", line 205, 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=/tmp/zig-cache ZIG_GLOBAL_CACHE_DIR=/tmp/zig-cache ../zig build-exe -mcpu=apple_a14 -OReleaseSafe zig-wrapper.zig
return_code=1
stderr=error(link): undefined reference to symbol '_isatty'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '___ulock_wait2'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_getenv'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_abort'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '__dyld_image_count'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_close$NOCANCEL'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_fstat'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_openat'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '___error'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '__dyld_get_image_header'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_pthread_threadid_np'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '__tlv_bootstrap'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_munmap'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_mmap'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_bzero'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_environ'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_sigaction'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_posix_memalign'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_fcntl'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '___stack_chk_fail'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_os_unfair_lock_unlock'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_os_unfair_lock_lock'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_malloc_size'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_execve'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_write'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '__dyld_get_image_name'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_free'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '__dyld_get_image_vmaddr_slide'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '___stack_chk_guard'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_read'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '_msync'
error(link):   first referenced in '/private/var/tmp/_bazel_james/a58facf4a3376e911b6755b87f30dbb8/external/zig_sdk/tools/zig-wrapper.o'
error(link): undefined reference to symbol '__availability_version_check'
error(link):   first referenced in '/private/tmp/zig-cache/o/970b38ac9fabc9361ed1c170362d1703/libcompiler_rt.a(/tmp/zig-cache/o/970b38ac9fabc9361ed1c170362d1703/libcompiler_rt.a.o)'
error(link): undefined reference to symbol '_sys_icache_invalidate'
error(link):   first referenced in '/private/tmp/zig-cache/o/970b38ac9fabc9361ed1c170362d1703/libcompiler_rt.a(/tmp/zig-cache/o/970b38ac9fabc9361ed1c170362d1703/libcompiler_rt.a.o)'
error(link): undefined reference to symbol 'dyld_stub_binder'
error: UndefinedSymbolReference

stdout=

You stumbled into a problem with Zig SDK that bazel-zig-cc was not able to fix.
Please file a new issue to github.com/uber/hermetic_cc_toolchain with:
- Full output of this Bazel run, including the Bazel command.
- Version of the Zig SDK if you have a non-default.
- Version of hermetic_cc_toolchain

Note: this *may* have been https://github.com/ziglang/zig/issues/14978, for
which hermetic_cc_toolchain has a workaround and you may have been "struck by
lightning" three times in a row.



### Platform(s)

Mac (Apple Silicon)

### What version of Prysm are you running? (Which release)

4.10.1

### Anything else relevant (validator index / public key)?

_No response_
@james-prysm james-prysm added the Bug Something isn't working label Oct 27, 2023
@james-prysm james-prysm changed the title Zig fetching errors in bazel Zig fetching errors in bazel after upgrading Mac Oct 27, 2023
@james-prysm james-prysm added the Tools Tools related tasks label Oct 27, 2023
@motiejus
Copy link

motiejus commented Nov 2, 2023

As mentioned in #zig slack, uber/hermetic_cc_toolchain#125 may help. I.e. try upgrading hermetic_cc_toolchain to current main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Tools Tools related tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants