Skip to content
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

cdylib for the target wasm32-wasi #64187

Closed
yurydelendik opened this issue Sep 4, 2019 · 1 comment · Fixed by #64188
Closed

cdylib for the target wasm32-wasi #64187

yurydelendik opened this issue Sep 4, 2019 · 1 comment · Fixed by #64188
Labels
C-feature-accepted Category: A feature request that has been accepted pending implementation. O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@yurydelendik
Copy link
Contributor

Problem
cannot produce cdylib for the target wasm32-wasi

Steps

  1. Add "cdylib" to the Cargo.toml, e.g.
    cargo new check-wasi && cd check-wasi
    echo "[lib]" >> Cargo.toml 
    echo "crate-type = [\"cdylib\"]" >> Cargo.toml
    
  2. Build using
    cargo +nightly build --target=wasm32-wasi
    
  3. Observe
    error: cannot produce cdylib for `check-wasi v0.1.0` as the target `wasm32-wasi` does not support these crate types
    

Possible Solution(s)
Allow cdylib for all wasm32-* targets: it's available for wasm32-unknown-unknown and is required by wasm-pack

@alexcrichton alexcrichton transferred this issue from rust-lang/cargo Sep 5, 2019
@alexcrichton
Copy link
Member

I've transferred this to the rust-lang/rust repository after debugging it and am working on a fix locally (the fix is here in the compiler, not in Cargo)

tmandry added a commit to tmandry/rust that referenced this issue Sep 10, 2019
rustc: Allow the cdylib crate type with wasm32-wasi

The wasm32-wasi target respects configuration around `crt-static` in
general, but is defaulted to being static. This interacted badly with
code which validated the `cdylib` crate type for `wasm32-wasi`,
erroneously saying that the `cdylib` crate type wasn't supported on
`wasm32-wasi` by default. This commit sets the appropriate flag in
`wasm32_wasi`'s target specification to indicate that the `cdylib` crate
type is supported regardless of `crt-static`

Closes rust-lang#64187
@jonas-schievink jonas-schievink added O-wasm Target: WASM (WebAssembly), http://webassembly.org/ C-feature-accepted Category: A feature request that has been accepted pending implementation. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 10, 2019
Centril added a commit to Centril/rust that referenced this issue Sep 10, 2019
rustc: Allow the cdylib crate type with wasm32-wasi

The wasm32-wasi target respects configuration around `crt-static` in
general, but is defaulted to being static. This interacted badly with
code which validated the `cdylib` crate type for `wasm32-wasi`,
erroneously saying that the `cdylib` crate type wasn't supported on
`wasm32-wasi` by default. This commit sets the appropriate flag in
`wasm32_wasi`'s target specification to indicate that the `cdylib` crate
type is supported regardless of `crt-static`

Closes rust-lang#64187
Centril added a commit to Centril/rust that referenced this issue Sep 11, 2019
rustc: Allow the cdylib crate type with wasm32-wasi

The wasm32-wasi target respects configuration around `crt-static` in
general, but is defaulted to being static. This interacted badly with
code which validated the `cdylib` crate type for `wasm32-wasi`,
erroneously saying that the `cdylib` crate type wasn't supported on
`wasm32-wasi` by default. This commit sets the appropriate flag in
`wasm32_wasi`'s target specification to indicate that the `cdylib` crate
type is supported regardless of `crt-static`

Closes rust-lang#64187
@bors bors closed this as completed in bb9d3be Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-accepted Category: A feature request that has been accepted pending implementation. O-wasm Target: WASM (WebAssembly), http://webassembly.org/ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants