Skip to content

Add a test case where one build script uses outputs of another one.#4045

Closed
bdolgov wants to merge 1 commit into
bazelbuild:mainfrom
bdolgov:defmt-bug
Closed

Add a test case where one build script uses outputs of another one.#4045
bdolgov wants to merge 1 commit into
bazelbuild:mainfrom
bdolgov:defmt-bug

Conversation

@bdolgov
Copy link
Copy Markdown
Contributor

@bdolgov bdolgov commented May 16, 2026

For more context, see #4011 (comment).

+@UebelAndre

[boris@sg4-pc-archvm cross_crate_build_script_outputs]$ bazelisk build :bin
ERROR: /home/boris/dev/rules_rust/cargo/tests/cargo_build_script/cross_crate_build_script_outputs/BUILD.bazel:21:12: Compiling Rust bin bin (1 file) failed: (Exit 1): process_wrapper failed: error executing Rustc command (from rust_binary rule target //cargo/tests/cargo_build_script/cross_crate_build_script_outputs:bin) bazel-out/k8-opt-exec/bin/util/process_wrapper/process_wrapper --env-file bazel-out/k8-fastbuild/bin/cargo/tests/cargo_build_script/cross_crate_build_script_outputs/bin_build_script.env --arg-file ... (remaining 18 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
error: linking with `/usr/bin/gcc` failed: exit status: 1
  |
  = note:  "/usr/bin/gcc" "-m64" "/home/boris/.cache/bazel/_bazel_boris/8f4b95ce8feef0ae7fb305d5fe7564a9/sandbox/linux-sandbox/199/execroot/_main/bazel-out/k8-fastbuild/bin/cargo/tests/cargo_build_script/cross_crate_build_script_outputs/rustc6TgZp8/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/home/boris/.cache/bazel/_bazel_boris/8f4b95ce8feef0ae7fb305d5fe7564a9/sandbox/linux-sandbox/199/execroot/_main/bazel-out/k8-fastbuild/bin/cargo/tests/cargo_build_script/cross_crate_build_script_outputs/rustc6TgZp8/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/boris/.cache/bazel/_bazel_boris/8f4b95ce8feef0ae7fb305d5fe7564a9/sandbox/linux-sandbox/199/execroot/_main/bazel-out/k8-fastbuild/bin/cargo/tests/cargo_build_script/cross_crate_build_script_outputs/bin_build_script.out_dir" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "bazel-out/k8-fastbuild/bin/cargo/tests/cargo_build_script/cross_crate_build_script_outputs/bin" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "-fuse-ld=gold" "-B/usr/bin" "-Wl,-no-as-needed" "-Wl,-z,relro,-z,now" "-pass-exit-codes" "-Wl,--push-state,-as-needed" "-lstdc++" "-Wl,--pop-state" "-Wl,--push-state,-as-needed" "-lm" "-Wl,--pop-state" "-Tscript_from_lib.x"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: /usr/bin/ld.gold: error: cannot open script_from_lib.x: No such file or directory
          /usr/bin/ld.gold: fatal error: unable to parse script file script_from_lib.x
          collect2: error: ld returned 1 exit status


error: aborting due to 1 previous error

Target //cargo/tests/cargo_build_script/cross_crate_build_script_outputs:bin failed to build
[boris@sg4-pc-archvm cross_crate_build_script_outputs]$ git revert 175bf94bddc7ddc341ea1708edb44eb23a035a69
Auto-merging rust/private/rustc.bzl
[defmt-bug 7ad581021] Revert "Add support for `experimental_output_paths` (#4011)"
 12 files changed, 329 insertions(+), 766 deletions(-)
[boris@sg4-pc-archvm cross_crate_build_script_outputs]$ bazelisk build :bin

INFO: From Compiling Rust (without process_wrapper) bin process_wrapper (6 files) [for tool]:
warning: the gold linker is deprecated and has known bugs with Rust
[skip]

warning: 1 warning emitted

INFO: Found 1 target...
Target //cargo/tests/cargo_build_script/cross_crate_build_script_outputs:bin up-to-date:
  ../../../../bazel-bin/cargo/tests/cargo_build_script/cross_crate_build_script_outputs/bin
INFO: Elapsed time: 1.552s, Critical Path: 1.32s
INFO: 14 processes: 178 action cache hit, 1 disk cache hit, 4 internal, 9 linux-sandbox.
INFO: Build completed successfully, 14 total actions

@UebelAndre
Copy link
Copy Markdown
Collaborator

I believe #4050 will solve this issue. Please let me know!

slackito pushed a commit to slackito/rules_rust that referenced this pull request May 21, 2026
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