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

Consider adding some WSL-specific help to README #135

Open
artavash opened this issue May 12, 2024 · 7 comments
Open

Consider adding some WSL-specific help to README #135

artavash opened this issue May 12, 2024 · 7 comments

Comments

@artavash
Copy link

artavash commented May 12, 2024

First of all thank you! Very excited to start using this.
There is a small gotcha I ran into because I use WSL environment. It will not run natively in it, you will need to cross-compile. It may be helpful to others?

Testing Locally with WSL

things to include in .cargo/config

[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"
ar = "x86_64-w64-mingw32-gcc-ar"

This can work if you've got mingw sudo apt install mingw-w64 (there maybe better linkers but i didn't investigate)
credit goes to these people: link

you may also need to add this target with rustup and the compiler will tell you if you don't have it

rustup target add x86_64-pc-windows-gnu

to see which targets you have run

rustup target list

Then compile to that target: cargo build --target x86_64-pc-windows-gnu
Have your Rust directories somewhere easily accessible on both, WSL bash and on Windows file explorer: it will make you a clickable .exe file that works natively

The error you get if you let it think it's in real linux is here:
Error: WinitEventLoop(Os(OsError { line: 81, file: "/home/xxxx/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.9/src/platform_impl/linux/wayland/event_loop/mod.rs", error: WaylandError(Connection(NoWaylandLib)) }))
I tested that a GUI is possible (there are some nuances depending if you have WSL1 or WSL2 link) and in my configuration a linux GUI can be successfully displayed from WSL.

@andreamancuso
Copy link

andreamancuso commented May 17, 2024

I was also affected. Thanks for sharing.

Sadly I am getting:

image

I think I'll try running it on my Ubuntu laptop over the weekend.

@c-git
Copy link
Contributor

c-git commented May 17, 2024

@andreamancuso were you able to get through following the steps posted by the OP?

@andreamancuso
Copy link

andreamancuso commented May 17, 2024

I wasn't. I'll try again ASAP, likely in the morning (I am based in the CEST time zone).

@artavash
Copy link
Author

Can you confirm you have a linker installed?
Something like
sudo apt install mingw-w64

Also it is probably worth executing the rustup command it suggests

@andreamancuso
Copy link

Good news.

You were right: as I am new to the Rust world, I didn't realize I was meant to run rustup target add x86_64-pc-windows-gnu. I then ran cargo build --target x86_64-pc-windows-gnu. Naturally I moved the folder into /mnt/c/<...> so I could easily access the generated .exe file.

Here's the end result:

image

Massive thanks for your help.

@andreamancuso
Copy link

I should point out last night I managed to build both targets on my Ubuntu laptop flawlessly. I can't wait to get started with my project.

@artavash
Copy link
Author

Awesome! I'll update the post to point out the rustup step.

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

No branches or pull requests

3 participants