enarx / codex

Code examples that can be compiled to WebAssembly for use with Enarx
Apache License 2.0
22 stars 14 forks source link

[Bug]: tokio-http example fails to compile #20

Closed MikeCamel closed 2 years ago

MikeCamel commented 2 years ago

Is there an existing issue for this?

Code of Conduct

Current Behaviour

Follow instructions here: https://enarx.dev/docs/webassembly/rust rustup target install wasm32-wasi Attempt to build https://github.com/enarx/codex/tree/main/Rust/tokio-http

[mike@gelid tokio-http]$ cargo build
   Compiling proc-macro2 v1.0.40
   Compiling unicode-ident v1.0.1
   Compiling autocfg v1.1.0
   Compiling quote v1.0.20
   Compiling syn v1.0.98
   Compiling libc v0.2.126
   Compiling futures-core v0.3.21
   Compiling pin-project-lite v0.2.9
   Compiling cfg-if v1.0.0
   Compiling log v0.4.17
   Compiling once_cell v1.12.0
   Compiling memchr v2.5.0
   Compiling futures-sink v0.3.21
   Compiling futures-channel v0.3.21
   Compiling futures-task v0.3.21
   Compiling wasi v0.11.0+wasi-snapshot-preview1
   Compiling futures-util v0.3.21
   Compiling futures-io v0.3.21
   Compiling pin-utils v0.1.0
   Compiling httparse v1.7.1
   Compiling bytes v1.1.0
   Compiling fnv v1.0.7
   Compiling itoa v1.0.2
   Compiling httpdate v1.0.2
   Compiling tracing-core v0.1.27
   Compiling slab v0.4.7
   Compiling tokio v1.20.0 (https://github.com/tokio-rs/tokio?rev=56be5286ee9548c483b91b7593ededcd34c5da0b#56be5286)
   Compiling http v0.2.8
   Compiling mio v0.8.4
error[E0658]: use of unstable library feature 'wasi_ext'
 --> /home/mike/.cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.8.4/src/io_source.rs:5:5
  |
5 | use std::os::wasi::io::AsRawFd;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #71213 <https://github.com/rust-lang/rust/issues/71213> for more information
  = help: add `#![feature(wasi_ext)]` to the crate attributes to enable

For more information about this error, try `rustc --explain E0658`.
error: could not compile `mio` due to previous error
warning: build failed, waiting for other jobs to finish...

Expected Behaviour

Compile should complete with no errors.

Environment Information

[mike@gelid tokio-http]$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/mike/.rustup

installed toolchains
--------------------

stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
1.57-x86_64-unknown-linux-gnu

installed targets for active toolchain
--------------------------------------

wasm32-wasi
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl

active toolchain
----------------

nightly-x86_64-unknown-linux-gnu (default)
rustc 1.64.0-nightly (4d6d601c8 2022-07-26)

Steps To Reproduce

See above.

MikeCamel commented 2 years ago

If this is related to https://github.com/enarx/codex/issues/16, then that should be updated to make it clear that tokio examples are also affected.

MikeCamel commented 2 years ago

Fixed. I was using an non-standard toolchain. Here's the fix: rustup default