Hey everybody!Started using Bazel as a build tool for a rust / js monorepo today and am running into an issue getting Rust to compile with a particular dependency. I don’t expect anyone to have exact answers as to why the dependency is failing, but wondering if anyone can point me in the right direction of where to look.I started off biting off more than I could chew and tried importing my API (rust) and web apps. After getting build errors, I decided to start over from a minimal project and got a plain “hello world” to compile / run. Then I started adding dependencies back to the Cargo.toml file until I got the error again and determined it was, in fact, a dependency problem. Here is the error I got:
ERROR: /private/var/tmp/_bazel_duncanlutz/ea7b65fa90c727036d06f9a3249350e0/external/crate_index__rav1e-0.7.1/BUILD.bazel:119:19: Running Cargo build script rav1e failed: (Exit 1): cargo_build_script_runner failed: error executing CargoBuildScriptRun command (from target @@crate_index__rav1e-0.7.1//:_bs)
(cd /private/var/tmp/_bazel_duncanlutz/ea7b65fa90c727036d06f9a3249350e0/sandbox/darwin-sandbox/21/execroot/_main && \
exec env - \
AR=/usr/bin/libtool \
CARGO_CRATE_NAME=rav1e \
CARGO_ENCODED_RUSTFLAGS='--sysroot=${pwd}/bazel-out/darwin_arm64-fastbuild/bin/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain\x1f--cap-lints=allow' \
CARGO_FEATURE_THREADING=1 \
CARGO_MANIFEST_DIR=bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs.cargo_runfiles/crate_index__rav1e-0.7.1/ \
CARGO_PKG_NAME=rav1e \
CARGO_PKG_VERSION=0.7.1 \
CARGO_PKG_VERSION_MAJOR=0 \
CARGO_PKG_VERSION_MINOR=7 \
CARGO_PKG_VERSION_PATCH=1 \
CARGO_PKG_VERSION_PRE='' \
CC=external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh \
CFLAGS='-U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer -mmacosx-version-min=15.1 -no-canonical-prefixes -Wno-builtin-macro-redefined -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted"' \
CXX=external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh \
CXXFLAGS='-U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer -std=c++14 -mmacosx-version-min=15.1 -no-canonical-prefixes -Wno-builtin-macro-redefined -D__DATE__="redacted" -D__TIMESTAMP__="redacted" -D__TIME__="redacted"' \
DEBUG=true \
HOST=aarch64-apple-darwin \
LD=external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh \
LDFLAGS='-mmacosx-version-min=15.1 -no-canonical-prefixes -fobjc-link-runtime -headerpad_max_install_names -lc++ -lm' \
NUM_JOBS=1 \
OPT_LEVEL=0 \
PATH=/opt/homebrew/opt/mysql@8.4/bin:/opt/homebrew/opt/make/libexec/gnubin:/Users/duncanlutz/.nvm/versions/node/v18.18.2/bin:/Users/duncanlutz/.gem/ruby/3.2.0/bin:/opt/homebrew/opt/ruby/bin:/Users/duncanlutz/Library/Python/3.9:/Users/duncanlutz/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/opt/homebrew/bin:/Users/duncanlutz/.local/bin \
PROFILE=debug \
RUSTC=bazel-out/darwin_arm64-fastbuild/bin/external/rust_darwin_aarch64__aarch64-apple-darwin__stable_tools/rust_toolchain/bin/rustc \
TARGET=aarch64-apple-darwin \
ZERO_AR_DATE=1 \
bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/external/rules_rust/cargo/cargo_build_script_runner/cargo_build_script_runner '--script=bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs-' '--links=' '--out_dir=bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs.out_dir' '--env_out=bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs.env' '--flags_out=bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs.flags' '--link_flags=bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs.linkflags' '--link_search_paths=bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs.linksearchpaths' '--dep_env_out=bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs.depenv' '--rundir=' '--cargo_manifest_args=@bazel-out/darwin_arm64-fastbuild/bin/external/crate_index__rav1e-0.7.1/_bs.out_dir-0.params')
# Configuration: 096dcc84165363e69a851ebe8131b032f5448c94ddc4951775429dc78e79f898
# Execution platform: @@platforms//host:host
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
Build script process failed with exit code 101
--stdout:
--stderr:
thread 'main' panicked at external/crate_index__built-0.7.1/src/environment.rs:53:9:
Missing expected environment variable "CARGO_PKG_AUTHORS"
Seemingly it comes down to the fact that the built crate expects a CARGO_PKG_AUTHORS variable to be passed to it, but that’s missing.I’ve confirmed that I can compile the project if I run the standard cargo build with no errors.Like I said, I don’t expect anyone to have a perfect solution but any tips on where to look next would be greatly appreciated. Thanks!