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

Error targeting wasm32-unknown-unknown #42

Closed
dsherret opened this issue Aug 3, 2020 · 4 comments
Closed

Error targeting wasm32-unknown-unknown #42

dsherret opened this issue Aug 3, 2020 · 4 comments

Comments

@dsherret
Copy link

dsherret commented Aug 3, 2020

Thanks for adding wasm support as this library was the only one that didn't allow using the Rust compiler in wasm. It seems though that it only works for wasm32-wasi and not wasm32-unknown-unknown. I'm not sure what the fix is.

Reproduction steps:

git clone https://github.com/rust-lang/stacker.git
cd stacker
cargo build --release --target wasm32-unknown-unknown

Outputs:

Compiling stacker v0.1.10 (/mnt/v/stacker)
error[E0412]: cannot find type `c_void` in crate `libc`
   --> src/lib.rs:121:35
    |
121 |             new_stack: *mut libc::c_void,
    |                                   ^^^^^^ not found in `libc`
    |
help: possible candidates are found in other modules, you can import them into scope
    |
35  | use std::ffi::c_void;
    |
35  | use std::os::raw::c_void;
    |

error: aborting due to previous error
@nagisa
Copy link
Member

nagisa commented Aug 9, 2020

Dependency on libc could be replaced with std::ffi...

@dsherret
Copy link
Author

dsherret commented Aug 9, 2020

@nagisa awesome. Thanks! I’m glad that was easy.

@ctaggart
Copy link

I would love to see a version of stacker published with this fix. It affects stacker v0.1.10 and unfortunately, a bunch of dependencies that rustfmt-nightly uses took a dependency on that.

$ cargo tree -i stacker
stacker v0.1.10
└── rustc-ap-rustc_data_structures v671.0.0
    ├── rustc-ap-rustc_arena v671.0.0
    │   └── rustc-ap-rustc_span v671.0.0
    │       ├── rustc-ap-rustc_ast v671.0.0
    │       │   ├── rustc-ap-rustc_ast_passes v671.0.0
    │       │   │   └── rustc-ap-rustc_expand v671.0.0
    │       │   │       └── rustfmt-nightly v2.0.0-rc.2 (https://github.com/rust-lang/rustfmt?rev=218593f2ac55030316c0b0546240843f0e32b292#218593f2)
    │       │   │           └── ts2rs v0.2.0 (/Users/cameron/rs/ts2rsapp)
    │       │   ├── rustc-ap-rustc_ast_pretty v671.0.0
    │       │   │   ├── rustc-ap-rustc_ast_passes v671.0.0 (*)
    │       │   │   ├── rustc-ap-rustc_attr v671.0.0
    │       │   │   │   ├── rustc-ap-rustc_ast_passes v671.0.0 (*)
    │       │   │   │   └── rustc-ap-rustc_expand v671.0.0 (*)
    │       │   │   ├── rustc-ap-rustc_expand v671.0.0 (*)
    │       │   │   ├── rustc-ap-rustc_parse v671.0.0
    │       │   │   │   ├── rustc-ap-rustc_ast_passes v671.0.0 (*)
    │       │   │   │   ├── rustc-ap-rustc_expand v671.0.0 (*)
    │       │   │   │   └── rustfmt-nightly v2.0.0-rc.2 (https://github.com/rust-lang/rustfmt?rev=218593f2ac55030316c0b0546240843f0e32b292#218593f2) (*)
    │       │   │   └── rustfmt-nightly v2.0.0-rc.2 (https://github.com/rust-lang/rustfmt?rev=218593f2ac55030316c0b0546240843f0e32b292#218593f2) (*)
    │       │   ├── rustc-ap-rustc_attr v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_expand v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_parse v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_session v671.0.0
    │       │   │   ├── rustc-ap-rustc_ast_passes v671.0.0 (*)
    │       │   │   ├── rustc-ap-rustc_attr v671.0.0 (*)
    │       │   │   ├── rustc-ap-rustc_expand v671.0.0 (*)
    │       │   │   ├── rustc-ap-rustc_parse v671.0.0 (*)
    │       │   │   └── rustfmt-nightly v2.0.0-rc.2 (https://github.com/rust-lang/rustfmt?rev=218593f2ac55030316c0b0546240843f0e32b292#218593f2) (*)
    │       │   └── rustfmt-nightly v2.0.0-rc.2 (https://github.com/rust-lang/rustfmt?rev=218593f2ac55030316c0b0546240843f0e32b292#218593f2) (*)
    │       ├── rustc-ap-rustc_ast_passes v671.0.0 (*)
    │       ├── rustc-ap-rustc_ast_pretty v671.0.0 (*)
    │       ├── rustc-ap-rustc_attr v671.0.0 (*)
    │       ├── rustc-ap-rustc_errors v671.0.0
    │       │   ├── rustc-ap-rustc_ast_passes v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_attr v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_expand v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_parse v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_session v671.0.0 (*)
    │       │   └── rustfmt-nightly v2.0.0-rc.2 (https://github.com/rust-lang/rustfmt?rev=218593f2ac55030316c0b0546240843f0e32b292#218593f2) (*)
    │       ├── rustc-ap-rustc_expand v671.0.0 (*)
    │       ├── rustc-ap-rustc_feature v671.0.0
    │       │   ├── rustc-ap-rustc_ast_passes v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_attr v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_expand v671.0.0 (*)
    │       │   ├── rustc-ap-rustc_parse v671.0.0 (*)
    │       │   └── rustc-ap-rustc_session v671.0.0 (*)
    │       ├── rustc-ap-rustc_parse v671.0.0 (*)
    │       ├── rustc-ap-rustc_session v671.0.0 (*)
    │       ├── rustc-ap-rustc_target v671.0.0
    │       │   ├── rustc-ap-rustc_ast_pretty v671.0.0 (*)
    │       │   └── rustc-ap-rustc_session v671.0.0 (*)
    │       └── rustfmt-nightly v2.0.0-rc.2 (https://github.com/rust-lang/rustfmt?rev=218593f2ac55030316c0b0546240843f0e32b292#218593f2) (*)
    ├── rustc-ap-rustc_ast v671.0.0 (*)
    ├── rustc-ap-rustc_ast_passes v671.0.0 (*)
    ├── rustc-ap-rustc_attr v671.0.0 (*)
    ├── rustc-ap-rustc_errors v671.0.0 (*)
    ├── rustc-ap-rustc_expand v671.0.0 (*)
    ├── rustc-ap-rustc_feature v671.0.0 (*)
    ├── rustc-ap-rustc_parse v671.0.0 (*)
    ├── rustc-ap-rustc_session v671.0.0 (*)
    ├── rustc-ap-rustc_span v671.0.0 (*)
    ├── rustc-ap-rustc_target v671.0.0 (*)
    └── rustfmt-nightly v2.0.0-rc.2 (https://github.com/rust-lang/rustfmt?rev=218593f2ac55030316c0b0546240843f0e32b292#218593f2) (*)

Workaround for now is pretty easy though:

[patch.crates-io]
stacker = { git = "https://github.com/rust-lang/stacker" }

@nagisa
Copy link
Member

nagisa commented Aug 16, 2020

Will do within next 15 minutes.

tmandry added a commit to tmandry/rust that referenced this issue Aug 18, 2020
…crum

update stacker to 0.1.11 to unbreak build for wasm32-unknown-unknown

Like rust-lang#72079, this updates stacker. The related problem is stacker is here rust-lang/stacker#42. It was fixed by switching from `libc::c_void` to `std::ffi::c_void` https://github.com/rust-lang/stacker/pull/43/files.
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 a pull request may close this issue.

3 participants