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

Revert "Pin to Bazel 7.3.2" #2998

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

UebelAndre
Copy link
Collaborator

Reverts #2957

Bazel 7.4.1 is now available https://github.com/bazelbuild/bazel/releases/tag/7.4.1

@UebelAndre UebelAndre marked this pull request as ready for review November 13, 2024 22:28
@UebelAndre
Copy link
Collaborator Author

Looks like this is failing due to missing tools on MacOS
https://buildkite.com/bazel/rules-rust-rustlang/builds/12660#019327a5-14f5-4751-ada1-786585f1b608

(23:39:56) ERROR: /Users/buildkite/builds/bk-macos-pln3-kbo2/bazel/rules-rust-rustlang/test/link_std_dylib/BUILD:3:26: Compiling Rust bin test_rust_binary_rust_binary (1 files) failed: (Exit 1): process_wrapper failed: error executing Rustc command (from target //test/link_std_dylib:test_rust_binary_rust_binary)
  (cd /private/var/tmp/_bazel_buildkite/de1f7ff191b09a2db838ec54aa1725ee/sandbox/darwin-sandbox/3429/execroot/rules_rust && \
  exec env - \
    CARGO_CFG_TARGET_ARCH=x86_64 \
    CARGO_CFG_TARGET_OS=darwin \
    CARGO_CRATE_NAME=test_rust_binary_rust_binary \
    CARGO_MANIFEST_DIR='${pwd}/test/link_std_dylib' \
    CARGO_PKG_AUTHORS='' \
    CARGO_PKG_DESCRIPTION='' \
    CARGO_PKG_HOMEPAGE='' \
    CARGO_PKG_NAME=test_rust_binary_rust_binary \
    CARGO_PKG_VERSION=0.0.0 \
    CARGO_PKG_VERSION_MAJOR=0 \
    CARGO_PKG_VERSION_MINOR=0 \
    CARGO_PKG_VERSION_PATCH=0 \
    CARGO_PKG_VERSION_PRE='' \
    REPOSITORY_NAME='' \
    ZERO_AR_DATE=1 \
  bazel-out/darwin_x86_64-opt-exec-ST-b61a9f73d34e/bin/util/process_wrapper/process_wrapper --subst 'pwd=${pwd}' -- bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/rust_toolchain/bin/rustc test/link_std_dylib/main.rs '--crate-name=test_rust_binary_rust_binary' '--crate-type=bin' '--error-format=human' '--out-dir=bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/test/link_std_dylib' '--codegen=opt-level=0' '--codegen=debuginfo=0' '--codegen=strip=none' '--remap-path-prefix=${pwd}=' '--emit=link=bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/test/link_std_dylib/test_rust_binary_rust_binary' '--emit=dep-info' '--color=always' '--target=x86_64-apple-darwin' -L bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/x86_64-apple-darwin/lib '--edition=2021' '--codegen=linker=external/local_config_cc/cc_wrapper.sh' '--codegen=link-arg=-mmacosx-version-min=14.5' '--codegen=link-arg=-no-canonical-prefixes' '--codegen=link-arg=-fobjc-link-runtime' '--codegen=link-arg=-Xlinker' '--codegen=link-arg=-rpath' '--codegen=link-arg=-Xlinker' '--codegen=link-arg=@loader_path/../../external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/x86_64-apple-darwin/lib' '--codegen=link-arg=-fprofile-instr-generate' '--codegen=link-arg=-headerpad_max_install_names' '--codegen=link-arg=-lc++' '--codegen=link-arg=-lm' '--codegen=instrument-coverage' '--codegen=prefer-dynamic' '--sysroot=bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/rust_toolchain')
# Configuration: 0c2507f56a7bacb6b4a53adedd08498312a34a10b46f8f2802de620c9b78bec2
# Execution platform: @@internal_platforms_do_not_use//host:host
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
error: linking with `external/local_config_cc/cc_wrapper.sh` failed: exit status: 127
  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -u XROS_DEPLOYMENT_TARGET LC_ALL="C" PATH="bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/x86_64-apple-darwin/bin:/private/var/tmp/_bazel_buildkite/de1f7ff191b09a2db838ec54aa1725ee/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/lib/rustlib/x86_64-apple-darwin/bin:/private/var/tmp/_bazel_buildkite/de1f7ff191b09a2db838ec54aa1725ee/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/lib/rustlib/x86_64-apple-darwin/bin" VSLANG="1033" ZERO_AR_DATE="1" "external/local_config_cc/cc_wrapper.sh" "-arch" "x86_64" "-m64" "/tmp/rustcqDYwOy/symbols.o" "bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/test/link_std_dylib/test_rust_binary_rust_binary.test_rust_binary_rust_binary.c9b212d5d7328a90-cgu.0.rcgu.o" "/private/var/tmp/_bazel_buildkite/de1f7ff191b09a2db838ec54aa1725ee/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/lib/rustlib/x86_64-apple-darwin/lib/libprofiler_builtins-340848fddf09154f.rlib" "/private/var/tmp/_bazel_buildkite/de1f7ff191b09a2db838ec54aa1725ee/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/lib/rustlib/x86_64-apple-darwin/lib/libstd-61602592c271c404.dylib" "/private/var/tmp/_bazel_buildkite/de1f7ff191b09a2db838ec54aa1725ee/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-304a1afb7a72a7c7.rlib" "-lSystem" "-lc" "-lm" "-L" "bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/x86_64-apple-darwin/lib" "-o" "bazel-out/darwin_x86_64-fastbuild-ST-7d47eb6a16ae/bin/test/link_std_dylib/test_rust_binary_rust_binary" "-Wl,-dead_strip" "-nodefaultlibs" "-mmacosx-version-min=14.5" "-no-canonical-prefixes" "-fobjc-link-runtime" "-Xlinker" "-rpath" "-Xlinker" "@loader_path/../../external/rust_darwin_x86_64__x86_64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/x86_64-apple-darwin/lib" "-fprofile-instr-generate" "-headerpad_max_install_names" "-lc++" "-lm"
  = note: ld: warning: ignoring duplicate libraries: '-lm'
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 132: basename: command not found
error: aborting due to 1 previous error

cc @krasimirgg @scentini @meteorcloudy

@meteorcloudy
Copy link
Member

Can you try to migrate to the Apple Silicon machines, basically replace macos with macos_arm64 in the presubmit.yml file.

@UebelAndre
Copy link
Collaborator Author

Can you try to migrate to the Apple Silicon machines, basically replace macos with macos_arm64 in the presubmit.yml file.

Trying here: #3000

@UebelAndre
Copy link
Collaborator Author

Can you try to migrate to the Apple Silicon machines, basically replace macos with macos_arm64 in the presubmit.yml file.

Trying here: #3000

CI is green there! Just need an approval!

@UebelAndre
Copy link
Collaborator Author

UebelAndre commented Nov 14, 2024

After updating the macos workers the failure persists
https://buildkite.com/bazel/rules-rust-rustlang/builds/12670#01932bc2-3259-43e7-9d07-d5c0607cd434

(18:44:48) ERROR: /Users/buildkite/builds/bk-macos-arm64-rvco/bazel/rules-rust-rustlang/test/link_std_dylib/BUILD:3:26: Compiling Rust bin test_rust_binary_rust_binary (1 files) failed: (Exit 1): process_wrapper failed: error executing Rustc command (from target //test/link_std_dylib:test_rust_binary_rust_binary)
  (cd /private/var/tmp/_bazel_buildkite/8be52a988e94d5d4f1cba4e36606cc35/sandbox/darwin-sandbox/3541/execroot/rules_rust && \
  exec env - \
    CARGO_CFG_TARGET_ARCH=aarch64 \
    CARGO_CFG_TARGET_OS=darwin \
    CARGO_CRATE_NAME=test_rust_binary_rust_binary \
    CARGO_MANIFEST_DIR='${pwd}/test/link_std_dylib' \
    CARGO_PKG_AUTHORS='' \
    CARGO_PKG_DESCRIPTION='' \
    CARGO_PKG_HOMEPAGE='' \
    CARGO_PKG_NAME=test_rust_binary_rust_binary \
    CARGO_PKG_VERSION=0.0.0 \
    CARGO_PKG_VERSION_MAJOR=0 \
    CARGO_PKG_VERSION_MINOR=0 \
    CARGO_PKG_VERSION_PATCH=0 \
    CARGO_PKG_VERSION_PRE='' \
    REPOSITORY_NAME='' \
    ZERO_AR_DATE=1 \
  bazel-out/darwin_arm64-opt-exec-ST-b61a9f73d34e/bin/util/process_wrapper/process_wrapper --subst 'pwd=${pwd}' -- bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/bin/rustc test/link_std_dylib/main.rs '--crate-name=test_rust_binary_rust_binary' '--crate-type=bin' '--error-format=human' '--out-dir=bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/test/link_std_dylib' '--codegen=opt-level=0' '--codegen=debuginfo=0' '--codegen=strip=none' '--remap-path-prefix=${pwd}=' '--emit=link=bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/test/link_std_dylib/test_rust_binary_rust_binary' '--emit=dep-info' '--color=always' '--target=aarch64-apple-darwin' -L bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/aarch64-apple-darwin/lib '--edition=2021' '--codegen=linker=external/local_config_cc/cc_wrapper.sh' '--codegen=link-arg=-mmacosx-version-min=14.5' '--codegen=link-arg=-no-canonical-prefixes' '--codegen=link-arg=-fobjc-link-runtime' '--codegen=link-arg=-Xlinker' '--codegen=link-arg=-rpath' '--codegen=link-arg=-Xlinker' '--codegen=link-arg=@loader_path/../../external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/aarch64-apple-darwin/lib' '--codegen=link-arg=-fprofile-instr-generate' '--codegen=link-arg=-headerpad_max_install_names' '--codegen=link-arg=-lc++' '--codegen=link-arg=-lm' '--codegen=instrument-coverage' '--codegen=prefer-dynamic' '--sysroot=bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain')
# Configuration: a62af274792e6ce2e2fc6cdd0506713976d5719025a4deba9bc7a344acbb07a8
# Execution platform: @@internal_platforms_do_not_use//host:host
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
error: linking with `external/local_config_cc/cc_wrapper.sh` failed: exit status: 127
  |
  = note: env -u IPHONEOS_DEPLOYMENT_TARGET -u TVOS_DEPLOYMENT_TARGET -u XROS_DEPLOYMENT_TARGET LC_ALL="C" PATH="bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/aarch64-apple-darwin/bin:/private/var/tmp/_bazel_buildkite/8be52a988e94d5d4f1cba4e36606cc35/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/lib/rustlib/aarch64-apple-darwin/bin:/private/var/tmp/_bazel_buildkite/8be52a988e94d5d4f1cba4e36606cc35/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/lib/rustlib/aarch64-apple-darwin/bin" VSLANG="1033" ZERO_AR_DATE="1" "external/local_config_cc/cc_wrapper.sh" "-arch" "arm64" "/tmp/rustcxZTpqb/symbols.o" "bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/test/link_std_dylib/test_rust_binary_rust_binary.test_rust_binary_rust_binary.c9b212d5d7328a90-cgu.0.rcgu.o" "/private/var/tmp/_bazel_buildkite/8be52a988e94d5d4f1cba4e36606cc35/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/lib/rustlib/aarch64-apple-darwin/lib/libprofiler_builtins-8dcd781448e20ddb.rlib" "/private/var/tmp/_bazel_buildkite/8be52a988e94d5d4f1cba4e36606cc35/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/lib/rustlib/aarch64-apple-darwin/lib/libstd-0b4a354a5d882f18.dylib" "/private/var/tmp/_bazel_buildkite/8be52a988e94d5d4f1cba4e36606cc35/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/lib/rustlib/aarch64-apple-darwin/lib/libcompiler_builtins-791901bf82ad4f12.rlib" "-lSystem" "-lc" "-lm" "-L" "bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/aarch64-apple-darwin/lib" "-o" "bazel-out/darwin_arm64-fastbuild-ST-7d47eb6a16ae/bin/test/link_std_dylib/test_rust_binary_rust_binary" "-Wl,-dead_strip" "-nodefaultlibs" "-mmacosx-version-min=14.5" "-no-canonical-prefixes" "-fobjc-link-runtime" "-Xlinker" "-rpath" "-Xlinker" "@loader_path/../../external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/aarch64-apple-darwin/lib" "-fprofile-instr-generate" "-headerpad_max_install_names" "-lc++" "-lm"
  = note: ld: warning: ignoring duplicate libraries: '-lm'
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 116: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 118: dirname: command not found
          external/local_config_cc/cc_wrapper.sh: line 132: basename: command not found
error: aborting due to 1 previous error

cc @meteorcloudy @krasimirgg

@meteorcloudy
Copy link
Member

Is it because PATH is somehow missing. dirname and basename definitely exist on the machine.

@meteorcloudy
Copy link
Member

bazelbuild/bazel@9e98051 is backported in 7.4.0 which uses dirname and basename. /cc @keith

One potential fix is to use /usr/bin/dirname and /usr/bin/basename instead.

@meteorcloudy
Copy link
Member

cc toolchain config scripts have been moved to rules_cc: https://github.com/bazelbuild/rules_cc/blob/main/cc/private/toolchain/osx_cc_wrapper.sh.tpl

It might be a good idea to fix it there. And with Bzlmod, if you add a bazel_dep on rules_cc, the toolchain from rules_cc will be picked up automatically.

@UebelAndre
Copy link
Collaborator Author

cc toolchain config scripts have been moved to rules_cc: https://github.com/bazelbuild/rules_cc/blob/main/cc/private/toolchain/osx_cc_wrapper.sh.tpl

It might be a good idea to fix it there. And with Bzlmod, if you add a bazel_dep on rules_cc, the toolchain from rules_cc will be picked up automatically.

@meteorcloudy

I tried to bump rules_cc here (#3002) and there appears to be a myriad of issues. What's the earliest version that contains the toolchain fix?

This also seems like a breaking change. I thought rules_rust was tested with changes to Bazel proper, if so, how would this have been missed?

@UebelAndre
Copy link
Collaborator Author

One potential fix is to use /usr/bin/dirname and /usr/bin/basename instead.

For MacOS this feels like an acceptable path forward. I'd rather not need to expose PATH to all actions by default. This should be a user choice and I would choose to avoid it so folks don't start introducing dependencies on un-tracked host tools.

@meteorcloudy
Copy link
Member

I tried to bump rules_cc here (#3002) and there appears to be a myriad of issues. What's the earliest version that contains the toolchain fix?

It's not yet fixed, as you can see in that file, dirname and basename were used instead of the full path.

I guess this change slipped through because it was not tested against rules_rust, which uses the tool in an action without PATH.

@meteorcloudy
Copy link
Member

I sent bazelbuild/rules_cc#275, but I also noticed your build is not yet fully on Bzlmod, so even if we have a new rules_cc, it's not easy to get the fix from it in WORKSPACE. So I guess the fast way to work around this issue is still to set PATH=/usr/bin env var.

copybara-service bot pushed a commit to bazelbuild/rules_cc that referenced this pull request Nov 18, 2024
BEGIN_PUBLIC
Copybara import of the project:

--
e485793 by Yun Peng <[email protected]>:

Use full path for dirname and basename in osx_cc_wrapper.sh.tpl

Context: bazelbuild/rules_rust#2998

END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=#275 from bazelbuild:meteorcloudy-patch-4 e485793
PiperOrigin-RevId: 697557587
Change-Id: I6ceb3d5f0fd747acb758926750fa48493edbdf3e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants