Does rust work in Cygwin? If so, how can I get it working?

Hello,
I was wondering if you could run Rust in Cygwin (without installing it in windows and calling that windows binary), is it possible or supported?

1 Like

In theory it should be possible to port Rust to Cygwin, but nobody has done it yet it seems:

https://github.com/rust-lang/rust/issues/5526

There's the MinGW one, or you could install the Linux ones in WSL.

1 Like

Out of curiosity, what would the benefit of a fully Cygwin version be? (Note that you can install both the MSYS/MinGW version and the MSVC version side by side, and access both from Cygwin.)

Theoretically, Rust for Cygwin would allow you to use fork and similar APIs and still produce executables running on Windows.

1 Like

Rust and cygwin "work", for some definition of work. But there will always be inconsistencies to varying degrees unless one builds a Rust distribution that uses the cygwin POSIX layer. A notable example of such an inconsistency is path handling. If you're using a Rust application within cygwin, it will work, to an extent, until you start needing features that rely on cygwin's path translation.

I wrote at length about this here: https://github.com/BurntSushi/ripgrep/issues/269#issuecomment-439734719

1 Like

Although its not critical, it would be very helpful to have Rust build tools available in Cygwin.

Rust is a build dependency of the popular python cryptography library as of 3.4.0 from 2021-02-07. Another popular library requires rust (due to cryptography) is pyopenssl.

The current workaround is to force installation of cryptography at 3.2.1 and pyopenssl at 21.0.0. This is not a huge issue at this time but I can see this issue getting worse over time.