Hacker News new | ask | show | jobs
by neonscribe 2681 days ago
What is the use case for Cygwin vs. WSL at this point?
9 comments

WSL filesystem performance is garbage, for one thing. Chances are good that if you're using Windows but you want to be using a Unix OS, it's your work that's forcing you to use Windows. And, if that's the case, chances are also good that the reason for that has something to do with a slew of legacy software that only runs on Windows. If both of those things are the case and you're trying desperately to develop a Unixy workflow, very clean integration with native Windows binaries is an unfortunate must. Cygwin delivers in that area much more effectively than WSL. Obviously Unix is my preference, but if I can't have Unix than I'd rather have Unix tools on the OS I'm being forced to use than a Unix sandbox will always be less than a real Linux/BSD install but fails to integrate properly with the OS I'm using by necessity.

The funny thing about both Cygwin and WSL is that, in my experience, many of the people who make use of them wish that they didn't have to make use of them. For me, Cygwin makes it a little easier for me to forget I'm not where I want to be (especially with things like winpty and apt-cyg). In Cygwin I can run URxvt just like at home, and run all the nonsense legacy software I need to for work, just like it were actually reasonable. In WSL, I can do none of that. It just doesn't work. I have a few co-workers who run WSL alongside cmd.exe. If I'm going to have to do that, I'd rather just stick to Cygwin.

Cygwin programs are (almost) native Windows programs. You can compile a POSIX-y program under Cygwin and it becomes a Windows program; you can ship it to a user if you just include a few DLL's that it needs.

I forked Cygwin's main DLL (cygwin1.dll) to create "Cygnal": an drop-in alternative that provides more Windows-like behaviors in various areas. Programs built under Cygwin can be bundled with Cygnal. Then (for instance) they have path handling that is familiar to Windows users.

WSL is great for when you can tolerate's WSL's incorrect, broken floating point math. [1]

If you need your math to be correct, use Cygwin.

[1] https://github.com/Microsoft/WSL/issues/830

What's broken is code that relies on long double offering more precision than double and expects to be portable. That's not guaranteed by the standard and isn't going to be true on all architectures.
To be fair, WSL claims to be (x86) Linux binary compatible. It's giving different results from actual Linux for the same binary.
Or pressure MS to fix it. They are rolling updates to WSL quite fast.
There's been pressure, it's not a priority.
It does seem a little niche, to be honest.
There's also Msys/gnuwin32 which has some advantages over cygwin.
Supporting Windows <10
Inertia

Access to Win32 APIs.

Static link and distribute to any windows user.

Better interoperability with Windows/cmd/powershell

Need to support Windows 7, for example.
Its nice to have alternatives.
You may consider that WSL is to Cygwin as Wine is to Winelib.