Skip to content

crate_info: Fix for out_binary#3814

Open
phlax wants to merge 1 commit intobazelbuild:mainfrom
phlax:still-not-out-binary
Open

crate_info: Fix for out_binary#3814
phlax wants to merge 1 commit intobazelbuild:mainfrom
phlax:still-not-out-binary

Conversation

@phlax
Copy link

@phlax phlax commented Jan 21, 2026

this has been an issue for a long time

http://github.com/bazelbuild/rules_rust/pull/1315

and is still an issue

this has been an issue for a long time

http://github.com/bazelbuild/rules_rust/pull/1315

and is still an issue

Signed-off-by: Ryan Northey <ryan@synca.io>
@phlax phlax force-pushed the still-not-out-binary branch from 9390587 to 9a4ef4a Compare January 21, 2026 08:09
@PiotrSikora
Copy link
Contributor

@UebelAndre could we please, please get this in? We (Proxy-Wasm Rust SDK, Proxy-Wasm C++ Host, Envoy) have been carrying this patch in every repo for the past 3+ years... While it's not a perfect solution, it really has no downsides, since it only affects out_binary feature that's broken without this anyway...

@illicitonion illicitonion added wasm expert-needed We lack maintainer expertise in this area. Contributions will need clear explanations & good tests. labels Feb 19, 2026
@UebelAndre
Copy link
Collaborator

Sorry for the delay here, can someone fill me in on the details of this change? What is the failure and what does this solve?

@PiotrSikora
Copy link
Contributor

PiotrSikora commented Mar 6, 2026

@UebelAndre Wasm modules are the final product, so we're using rust_binary(out_binary=True) to create .wasm files, since using rust_library creates .rlib files, which is not what we want.

Building rust_binary() without out_binary doesn't work, since it's expecting an executable:

$ bazel build --platforms=@rules_rust//rust/platform:wasi //:http_auth_random
ERROR: //BUILD:42:12: in rust_binary rule //:http_auth_random:                                                            
.../external/rules_rust+/rust/private/rustc.bzl:1699:20: The rule 'rust_binary' is executable. It needs to create an executable File and pass it as the 'executable' parameter to the DefaultInfo it returns.                                
ERROR: //BUILD:42:12: Analysis of target '//:http_auth_random' (config: d0d6886) failed 

Bulding rust_binary(out_binary=True) used to work, but fails since #1298:

$ bazel build --platforms=@rules_rust//rust/platform:wasi //:http_auth_random
ERROR: //BUILD:42:12: in rust_binary rule //:http_auth_random: 
.../external/rules_rust+/rust/private/rust.bzl:251:5: rule advertised the 'CrateInfo' provider, but this provider was not among those returned
ERROR: //BUILD:42:12: Analysis of target '//:http_auth_random' (config: d0d6886) failed

Building rust_binary(out_binary=True) with this patch (from #1315) builds .wasm module just fine:

$ bazel build --platforms=@rules_rust//rust/platform:wasi //:http_auth_random
INFO: Analyzed target //:http_auth_random (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //:http_auth_random up-to-date:
  bazel-bin/http_auth_random.wasm

(You can replicate this in https://github.com/proxy-wasm/proxy-wasm-rust-sdk by commenting out the rules_rust.patch in MODULE.bazel and/or bazel/repositories.bzl if you want...)

The timeline is:

There is some prior discussion in comments in those issues, as well as in #771.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

expert-needed We lack maintainer expertise in this area. Contributions will need clear explanations & good tests. wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants