"Linking with "cc" failed: exit code: 1" with an big exception

Hey, I’m trying to build my little rust program, using tokio, on windows 10 for linux.
I’m using the stable-msvc toolchain and the target is x86_64-unknown-linux-gnu.
But while compiling, I get a big error.

(I put it one pastebin, because it IS big) Error click

I hope somebody can help me.

Unfortunately, it’s not enough to specify --target to get cross-compilation working. That will only produce object files/static libraries, but it won’t know how to build an executable.

Rust doesn’t ship with its own linker and system libraries. On Windows you only have MSVC’s linker, which of course is incapable of linking Linux executables. Similarly you have only Windows DLLs, and not Linux’s system libraries (like glibc).

I don’t know if anyone has build and packaged these for Windows. It’s generally so much hassle that everyone recommends NOT to cross-compile, and just Rust on run full Linux in a virtual machine or WSL.

1 Like

Jep. That worked! Thanks :slight_smile: