WebAssembly / wasi-sdk

WASI-enabled WebAssembly C/C++ toolchain
Apache License 2.0
1.27k stars 190 forks source link

error[E0658]: using an imported function as entry point `main` is experimental #450

Open yamt opened 3 months ago

yamt commented 3 months ago

i saw the following error while doing "cmake --build build/toolchain --target dist". i guess rust/cargo requirements should be documented in https://github.com/WebAssembly/wasi-sdk?tab=readme-ov-file#requirements.

error[E0658]: using an imported function as entry point `main` is experimental
 --> /Users/yamamoto/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasm-component-ld-0.5.5/src/main.rs:1:5
  |
1 | use wasm_component_ld::main;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #28937 <https://github.com/rust-lang/rust/issues/28937> for more information

For more information about this error, try `rustc --explain E0658`.
error: could not compile `wasm-component-ld` (bin "wasm-component-ld") due to 1 previous error
error: failed to compile `wasm-component-ld v0.5.5`, intermediate artifacts can be found at `/var/folders/74/hw1sphgx0lv63q6pq_n5grw00000gn/T/cargo-installJIGQGF`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
ninja: build stopped: subcommand failed.
alexcrichton commented 3 months ago

Yes this is a toolchain error where the Rust toolchain you're using is too old. Once https://github.com/bytecodealliance/wasm-component-ld/pull/36 gets published you'll get a better first-class error message when the toolchain is too old.