-
Notifications
You must be signed in to change notification settings - Fork 435
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
add flag to allow putting out binary whenever #312
Conversation
Hi, Thanks for contributing. Could you expand a bit more on the purpose of this PR? Maybe by giving an example? Also the build is failing, you should be able to reproduce with |
@damienmg Thanks. This functionality is needed on this PR. I'd like to build Rust code like this into This code is build with this build config. We want to put out binary but not want to build with I'm considering to use this like this. This will put out
|
Ok I am not really happy with the interface this PR offer but I cannot think of something better, maybe @mfarrugi or @acmcarther have a better opinion. |
I don't feel particularly strongly about this. It does seem to solve a preexisting problem, though it seems this might be wasm-specific? out_binary=true should be implicit for a rust_binary rule. Can we just infer this? It's also hard to infer the purpose of crate_type on rust_binary if you're not steeped in the wasm context. In fact, I'm not even really sure what this does. Does it emit both a library and a binary? Reading the relevant Cargo.toml it's not obvious to me that this is supposed to produce a "binary" at all. Does rust_library work for this? I suspect I'm missing something critical here. |
I have no idea why it having rust_library build the cdylib doesn't work, and I can't guess what cdylib means for wasm. Does executable mean something special for wasm? |
@acmcarther @mfarrugi I think that this is not "binary" but "library" because we emit wasm module. But it seems that
I think that this is not so, but I have no idea to use this functionality on a normal binary.
I also have no idea about this. Maybe cc. @PiotrSikora have some idea. |
See previous discussion: #240 (comment)
|
@mfarrugi @acmcarther was there a consensus on moving forward with that change? |
I can't really opine, don't know anything about wasm. To me this stuff looks a little grody, but it's not a lot of code. |
We may ought to implement |
Sorry for taking so long to come back to this one. I don't see strong opinion either way. |
The ability to build Wasm libraries as executables is needed to support WASI reactors (Wasm executables with multiple entrypoints). This is a temporary workaround, and we should be able to use crate-type "bin" when a proper support for WASI reactors (rust-lang/rust#79997) is stabilised is Rust. This feature was added in bazelbuild#312, and most recently broken in bazelbuild#592. Signed-off-by: Piotr Sikora <[email protected]>
* Re-add support for building Wasm libraries as executables. The ability to build Wasm libraries as executables is needed to support WASI reactors (Wasm executables with multiple entrypoints). This is a temporary workaround, and we should be able to use crate-type "bin" when a proper support for WASI reactors (rust-lang/rust#79997) is stabilised is Rust. This feature was added in #312, and most recently broken in #592. Signed-off-by: Piotr Sikora <[email protected]> * review: sort. Signed-off-by: Piotr Sikora <[email protected]> Co-authored-by: Marcel Hlopko <[email protected]>
We had an opportunity to put out binary without specifying
crate_type
asbin
.In this case, we should add configurable crate_type and a flag to put out binary whenever.
With this patch, we can tackle this situation.