tokio-rs / mio

Metal I/O library for Rust.
MIT License
6.33k stars 733 forks source link

Getting build errors in my project (total Rust noob) #1837

Open Industrial opened 1 week ago

Industrial commented 1 week ago

Hi.

So I (TypeScript/React developer) decided to spend my weekend learning Rust and creating a ToDo application using Leptos and Axum (apparently).

I'm using Github, Nix (Flakes) (CI), Leptos (Web Framework), Axum (HTTP Server/API?) and Shuttle.rs (WASM Host) to eventually serve a Hello World page.

The problem I'm experiencing is: https://gist.github.com/Industrial/5a6c60704c704a5f50aa9d949d8cb29f

You can find it failing in github actions at https://github.com/Industrial/skeleton-nodejs/actions/runs/11299910277/job/31431827709

The reproduction is:

git clone https://github.com/Industrial/skeleton-nodejs.git
cd skeleton-nodejs/applications/test-leptos
nix develop
bin/install
bin/build
bin/dev

Any help would be appreciated.

Thomasdezeeuw commented 1 week ago

I don't know what cargo/rustc command you're running. So it's a little difficult to debug.

You might be missing some Mio features, can you try adding "features" = ["os-poll", "net"] (maybe os-ext, not sure if your code needs it) to Cargo.toml?

Darksonn commented 1 week ago

Try deleting the /Users/twieland/.cargo/registry folder and let cargo redownload stuff. I've sometimes seen errors like this from people who accidentally modified a file of a downloaded crate in the registry.

Industrial commented 1 week ago

Hi. I tried doing both suggestions and I'm still getting the same error.

It also fails in the pipeline with Nix: https://github.com/Industrial/skeleton-nodejs/actions/runs/11299910277/job/31431827709

@Thomasdezeeuw The commands I'm running locally are:

cargo install --path .
cargo build
cargo leptos watch

I realize I've just piled up the dependencies and don't really know what I'm doing so I'll try removing things one by one til I get a working state :)

Thomasdezeeuw commented 1 week ago

Is leptos using Wasm preview v2? Mio doesn't support that yet.

If you look at the target directory does it have a directory called wasm32-wasip2?