Skip to content

Conversation

notoriaga
Copy link
Contributor

Another random compatibility issue, after updating the rust tool chain it can't find basename when linking with our custom toolchain - copied this from rules_cc https://github.com/bazelbuild/rules_cc/blob/0fee42b524315fd16c197877f24d5b8ba0a9a1ee/cc/private/toolchain/osx_cc_wrapper.sh.tpl#L42

I checked and we aren't using any of the other tools they impl that pattern for

@notoriaga notoriaga requested a review from a team as a code owner September 11, 2025 20:31
@notoriaga
Copy link
Contributor Author

was the error - https://jenkins.ci.swift-nav.com/blue/organizations/jenkins/swift-nav%2Forion_proto/detail/PR-2049/1/pipeline

seems to have fixed it on linux/in CI https://github.com/swift-nav/orion_proto/pull/2049/commits/04e119196d51c1a0c1655055a488328771beae23

but I get a different error on mac now

2 % bazel build //rust/proto_bindings --verbose_failures --sandbox_debug
INFO: Analyzed target //rust/proto_bindings:proto_bindings (0 packages loaded, 0 targets configured).
ERROR: /private/var/tmp/_bazel_steve/b6a1562d734d15f09be62d94abe002e0/external/rules_rust+/util/process_wrapper/BUILD.bazel:31:36: Compiling Rust (without process_wrapper) bin process_wrapper (6 files) [for tool] failed: (Exit 1): sandbox-exec failed: error executing Rustc command
  (cd /private/var/tmp/_bazel_steve/b6a1562d734d15f09be62d94abe002e0/sandbox/darwin-sandbox/1175/execroot/_main && \
  exec env - \
    CARGO_CFG_TARGET_ARCH=aarch64 \
    CARGO_CFG_TARGET_OS=macos \
    CARGO_CRATE_NAME=process_wrapper \
    CARGO_MANIFEST_DIR='${pwd}/external/rules_rust+/util/process_wrapper' \
    CARGO_PKG_AUTHORS='' \
    CARGO_PKG_DESCRIPTION='' \
    CARGO_PKG_HOMEPAGE='' \
    CARGO_PKG_NAME=process_wrapper \
    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=rules_rust+ \
    TMPDIR=/var/folders/g_/9wp93_mx46d2zzcf9nywcdm00000gn/T/ \
  /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_steve/b6a1562d734d15f09be62d94abe002e0/sandbox/darwin-sandbox/1175/sandbox.sb /var/tmp/_bazel_steve/install/238d60da91a7fad3983c54b8c9e828b0/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_steve/b6a1562d734d15f09be62d94abe002e0/sandbox/darwin-sandbox/1175/stats.out' bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust+/util/process_wrapper/bootstrap_process_wrapper.sh -- bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_macos_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/bin/rustc external/rules_rust+/util/process_wrapper/main.rs '--crate-name=process_wrapper' '--crate-type=bin' '--error-format=human' '--out-dir=bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust+/util/process_wrapper' '--codegen=opt-level=3' '--codegen=debuginfo=0' '--codegen=strip=debuginfo' '--remap-path-prefix=${pwd}=.' '--emit=link=bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust+/util/process_wrapper/process_wrapper' '--emit=dep-info' '--color=always' '--target=aarch64-apple-darwin' -L bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_macos_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/lib/rustlib/aarch64-apple-darwin/lib '--edition=2018' '-Cembed-bitcode=no' '--codegen=linker=external/rules_swiftnav+/cc/toolchains/llvm/aarch64-darwin/wrappers/clang' '--codegen=link-arg=-mmacos-version-min=15.2' '--codegen=link-arg=--target=aarch64-apple-macosx' '--codegen=link-arg=-lm' '--codegen=link-arg=-no-canonical-prefixes' '--codegen=link-arg=-headerpad_max_install_names' '--codegen=link-arg=-Wl,-no_warn_duplicate_libraries' '--codegen=link-arg=-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib' '--codegen=link-arg=-lc++' '--codegen=link-arg=-lc++abi' '--codegen=link-arg=-Lexternal/aarch64-darwin-llvm/lib' '--codegen=link-arg=--sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' '--extern=tinyjson=bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust++i+rules_rust_tinyjson/libtinyjson-1317710085.rlib' '-Ldependency=bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust++i+rules_rust_tinyjson' '--sysroot=bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust++rust+rust_macos_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain' '-Cstrip=debuginfo')
error: linking with `external/rules_swiftnav+/cc/toolchains/llvm/aarch64-darwin/wrappers/clang` failed: exit status: 1
  |
  = note:  "external/rules_swiftnav+/cc/toolchains/llvm/aarch64-darwin/wrappers/clang" "/var/folders/g_/9wp93_mx46d2zzcf9nywcdm00000gn/T/rustcw0SLNB/symbols.o" "<17 object files omitted>" "/private/var/tmp/_bazel_steve/b6a1562d734d15f09be62d94abe002e0/execroot/_main/bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust++i+rules_rust_tinyjson/{libtinyjson-1317710085.rlib}.rlib" "<sysroot>/lib/rustlib/aarch64-apple-darwin/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-lSystem" "-lc" "-lm" "-arch" "arm64" "-mmacosx-version-min=11.0.0" "-L" "<sysroot>/lib/rustlib/aarch64-apple-darwin/lib" "-o" "bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust+/util/process_wrapper/process_wrapper" "-Wl,-dead_strip" "-nodefaultlibs" "-mmacos-version-min=15.2" "--target=aarch64-apple-macosx" "-lm" "-no-canonical-prefixes" "-headerpad_max_install_names" "-Wl,-no_warn_duplicate_libraries" "-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" "-lc++" "-lc++abi" "-Lexternal/aarch64-darwin-llvm/lib" "--sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: clang: error: unable to execute command: Executable "ld" doesn't exist!
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

])
else:
link_flags.extend([
"-B/usr/bin", # Tell clang where to find system linker
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was the other fix needed for mac in addition to the basename thing

@notoriaga notoriaga merged commit 7a565a8 into main Sep 15, 2025
2 checks passed
@notoriaga notoriaga deleted the steve/basename branch September 15, 2025 17:54
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