5 ms·
How to develop on Windows: comparing native, MinGW, Cygwin, WSL
- twiss 2y ago> a lot of tools are made primarily for Linux. Surprisingly this even includes very popular ones like Git A bit off-topic but this particular example becomes less surprising if you look up who created git :)
- giancarlostoro 2y agoNot only who create git, but why specifically they created git.
- baq 2y agoHow to make people who were there to witness it and migrated projects from subversion before GitHub was a thing feel old. Twas only yesterday dammit
- steve1977 2y agoImagine how old you feel when you remember Subversion being the new thing replacing CVS…
- tilt_error 2y agoOr moving from RCS to CVS.
- deleted 2y ago[deleted]
- shrimp_emoji 2y agoBut why did they create it? Linux (UNIX) is an engineering OS. Windows is a slap dash Product chaotically rushed out and now buried under several layers of fad-strata that was meant to help moms store recipes on their kitchen PC. This is directly reflected in the development experience and culture.
- steve1977 2y agoThis is wrong on so many levels. Linux started out as a hobby project. In contrast, Windows NT started out as a well designed system made by seasoned professionals.
- shrimp_emoji 2y ago... Linux was a hobby project copying UNIX. And Windows NT's "good design and professional pedigree" must be subtle because Windows is a hot, disorganized mess that's hell to use or develop in.
- steve1977 2y agoWell Linux needs Docker containers to make deployment and dependency handling manageable, so I’m not too sure which one is the hotter mess.
- forrestthewoods 2y ago> Developing on Windows can be frustrating As a primarily Windows developer of video games I find developing on Linux far more frustrating, fragile, and error prone than Windows. However it's less about which is better or worse, and more about the devil you know. Setting up a brand new macOS for development is excruciating. Learning Linux is an extremely long, time consuming, and painful experience. But once you've built up some scar tissue it doesn't seem so bad! > The cleanest way is to just use Linux on Windows Hard hard hard disagree. I could not possibly disagree more strongly. I violently and disrespectfully disagree. > The other option is to use Windows proper This is the way. Don't use Cygwin or MinGW-64. That is bad advice. I write a lot of C++ code. It typically needs to run on Windows, macOS, Linux, and Android. My experience is that Windows developers are generally content to step out of their comfort zone and work on macOS and Linux "natively". My personal lived experience is that Linux-first developers are far and away the least likely to even think of Windows or other platforms. They frequently refuse to request a Windows machine so they can even test another platform. Which means I have to fix all their broken code, grumble grumble. If you hard coded /usr/lib or similar you're a bad person. My recommendation is to simply learn Windows and do things the native Windows way. Stop assuming all platforms are Linux. Cross-platform is a solved and relatively simple problem. Trying to force everything to behave The Linux Way is pain and suffering. Personally I think "The Linux Way" is generally quite bad. Try something different! Be open to new experiences! Don't dip your toes in the water, jump in the deep end! You might learn a thing or two. And who knows, you may even discover it's quite pleasant.
- tracker1 2y agoIt depends on what you are making more than anything. If you're writing services that will be deployed on Linux servers (to save cost, increase availability, etc), then using WSL2 is probably the best bet if you must use Windows. I've done a fair amount of Windows services development as well as services deployed to Linux. I'll honestly take the Linux way, in particular Docker/containers as a target. It works when you build, works when you deploy, no surprises, no separately installing a dozen dependencies that blow each other up, like in Windows a lot of times.
- 2y ago
- neilv 2y ago> The cleanest way is to just use Linux on Windows, via a full VM, or through WSL2, which is a lightweight, well-integrated VM. The cleanest way is to get a job that doesn't require you to develop on Microsoft Windows. Then you can just use Debian Stable, or some other decent Linux distro.
- xyst 2y agoTrue, but at most corporate firms or regulated industries you often have no choice. Good luck trying to get on the corp network in a dual booted system that doesn’t have their usual spyware/corp suite of shit ware and of course ClownStrike Falcon crap.
- commercialnix 2y ago> at most corporate firms Some time around mid-2012, at two different higher end of software development firms, the target system for 90+% of clients was some open source language such as Java, Node, Python, Scala, Ruby, targeting some Linux. At one of these our DevOps went ahead without even really being asked to at least monitor that our builds ran successfully on BSD and illumos, and occasionally patch as necessary. For clients asking us to work on .NET there was a premium charge and ZeroMQ was used to "bridge" .NET with something else. The only clients that successfully insisted on pure .NET did so by paying a bigger premium charge. By 2018, we were doing heavy sideways discounts on ".NET core for Linux" in the form of heavy premium charges for the alternative. > Good luck trying to get on the corp network [with] ClownStrike Falcon crap. This is what a virtual machine is for.
- neonsunset 2y agoWhat is your current policy regarding .NET?
- commercialnix 2y agoIn these places we wouldn't call it a "policy" but just how we did things. One of the devs there was talking to someone about "implementing any calls in .NET" as NetMQ (native ZeroMQ for .NET) using an exclusive pair socket to pass Apache Thrift back and forth to Rust codebase also using the exclusive pair socket. One of the phrases I heard was "all code we contribute is accessible to your existing .NET devs". The term accessible may not mean readable or maintainable for the .NET devs in that context, but the corporate customers seemed comfortably confident they would continue to have a relationship with the firm so whatever.
- xyst 2y ago[flagged]
- invokestatic 2y agoMy go to on Windows is LLVM using the Windows SDK for libc. Before Microsoft had solved the whole msvcrt redistributable mess I used mingw-64 as the libc which worked pretty well actually.
- rubymamis 2y agoHonestly, Qt C++ & QML is the best way to develop on Windows (and Linux). Soon enough, I'll also prove it's the best for macOS (under some specific expectations).
- anthk 2y agoQT5 has great support under MInGW even by crosscompiling it from GNU/Linux to Windows.
- axus 2y agoI had a lot of fun using MSYS2 / MinGW64 and building things for Windows, but I can't imagine it being fun for most people. Installing git-for-windows was an easy way to try it out, to see if that rabbit hole is for you.
- delta_p_delta_x 2y agoHere we go: a thread on developing for Windows, and immediately there are several top-level comments saying 'don't'. I suppose you guys like leaving 75% of a potential install base out of consideration. More money for us Windows devs, I guess. After having recently worked on a project at work that involved precisely this (migrating a Linux/macOS-first project to Windows), I feel like that table at the top is... not the whole story. I also disagree with the author's conclusion: the easiest and most compatible way to develop on Windows is to use Visual Studio 2022, full stop. Download, install the Desktop Development with C++ workload, and start writing code. Can't be easier. It comes with a built-in debugger, profiler, and various build tools like CMake, Ninja (if you don't like MSBuild/NMake), Clang-CL (if you don't like cl.exe), and much more. My background is a little different to the author: I've been writing on and for Windows most of the time, and I was only introduced to Linux in university. In order of 'closeness to Linux': - WSL1/2: these are for all intents and purposes Linux VMs (yes, not in the case of WSL1, but practically it might as well be). Use these as though you would a real Linux machine. - Cygwin: in general, never use Cygwin for new projects. Cygwin means saddling your user with an entire Linux filesystem hierarchy per application, including stuff like `/bin`, `/etc`, `/lib`, and so on. Additionally, it pretends to support `fork()` on Windows. Windows and NT don't have fork(). Never had, and never will. Don't use it, full stop. - MinGW: this targets the Itanium C++ ABI. An admirable but sadly incomplete effort. New Win32 APIs like cfapi.h[1] aren't available. Big Windows-specific libraries like Microsoft's WIL[2] cannot compile on MinGW because they rely on MSVC-specific extensions. Deal-breaker for me. - MSVC providing cl.exe, and also LLVM's official Clang releases for Windows: best options. These target the MSVC C++ ABI and expect/provide a complete install of the Windows SDK and MSVC C and C++ runtimes. In general, I dislike shoehorning Linux/UNIX onto Windows and vice versa. System developers should recognise the differences between OS and platform-specific primitives, APIs, and interfaces, and abstract over them depending on their needs. Each implementation should live on its own and should be linked to by the build system, and not directly interspersed in code. This means no `#ifdef _WIN32 #elifdef DARWIN #elifdef __linux`. Or—and a hot take incoming—if you don't want to do any of this, use a platform-independent managed/interpreted language like Java, C#, Go, or Python. [1]: https://learn.microsoft.com/en-us/windows/win32/api/cfapi/ https://learn.microsoft.com/en-us/windows/win32/api/cfapi/ [2]: https://github.com/microsoft/wil/issues/117 https://github.com/microsoft/wil/issues/117
- externedguy 2y agoSwitch to Linux
- osigurdson 2y agoIf you just want basic Linux utilities, create a Windows terminal profile pointing to C:\Program Files\Git\bash.exe. You likely have git installed anyway and this works very well. I use this all the time.
- chrisweekly 2y agobut it's... so... slow.... I use windows only bc I have no choice at work. the DX is painful.
- aezart 2y agoIf it's a work machine, you probably have network drives. Git bash is incredibly slow when working with network drives.
- chrisweekly 2y agoI'm talking about local filesystem. Things like reflecting git status in $PS1 take many hundreds of milliseconds...
- osigurdson 2y agobash is slow? Maybe, but I've never noticed a problem. I have opened huge files in vim as well.
- CRConrad 2y agoThe bash in MinGW-64, or whatever it's called that comes with git for Windows. Which doesn't come with vim, IIRC, so that can't have been what you're talking about, right?
- OhMeadhbh 2y ago+1 After falling out of love with macOS a couple decades ago, I've been using WSL/VMs on Win{7|10|11}. While I sort of detest the ads on my corporate Win11 laptop, it's what the corporation requires I use. VirtualBox on Win7 was a very usable solution. WSL1 on Win10 was a tiny bit rough, but WSL2 on Win10/11 has been pretty decent. The only problem I have is it's unclear who "owns" mDNS: windows side or leenucks side. For most of the last several years it just plain didn't work on the leenucks side. Then a work-around was published, but it seems to not work now. But... I love small charts like this. I hadn't been thinking about cygwin or MinGW. It's good to be reminded they still exist.
- tomas_impressi 2y ago[dead]
- atVelocet 2y agoI don’t like this article as it seems the author did not dive a bit into some of the topics he mentions. As an example I wanna point out WSL2 and USB support: https://github.com/dorssel/usbipd-win https://github.com/dorssel/usbipd-win This is the recommended way and works as expected. It is also possible to directly mount WSL2 drives with near native performance.
- BoredPositron 2y agoEverytime I read articles like this no one brings up that wsl caches file transfers in RAM. With large enough transfers it slows your machine to a halt. It's infuriating and made me switch to Linux for heavy workloads.
- skrebbel 2y agoNitpick, the article’s suggestion that Git badly supports Windows strikes me as about 2 decades out of date. I dev on native Windows (only using WSL for key tools like sl and cowsay) and Git has Just Worked pretty much ever since I began using it. Maybe the only speedbump is that you gotta remember to turn off the “autocrlf” setting, which has a default from way back when there were still editors on Windows that choked on \n.
- ryukoposting 2y agoHaving only recently dropped Windows as my OS of choice for professional matters, I can get behind this statement. On rare occasions, the line ending stuff got weird. Other than that, it was smooth sailing.
- pxc 2y agoWindows can't handle symlinks in a sane way because they're a source of privilege escalation exploits on Windows. So git repos with symlinks in the require a security degradation to use them natively. Performance also still sucks, although the VFS stuff in the Microsoft fork kinda helps I guess.
- Kenji 2y ago[dead]
- vips7L 2y agoThe only issues I have when developing natively on Windows are when other developers on macOS don't use cross-platform tools (bash scripts). Scoop is a great package manager, and with windows-terminal + powershell you can't really ask for anything better.
- rock_artist 2y agoI wonder, What’s the key features that make scoop better than winget. (I use winget as it seems to be now available out of the box)
- vips7L 2y agoFor me: winget still is missing critical tools that I need, most notably maven. I've also found scoop extremely easy to contribute too. I also don't need to worry about it pulling packages from the windows store or running installers that won't install to my user directory.
- anthk 2y agoSomething about synchronicity, serendipia, Jung, David F.Peat... must be true, because I've been trying to compile stuff with mingw for days and then it's not odd to see that either at HN, Reddit or the Spanish Digg/Reddit clone. Jokes being put aside, I've got to cross-compile Kristall for MinGW (Windows 32 bit target, for W7), but it required tons of deps and it the end it gave me errros on some libs, so I will rebuild it statically with the full src in a parallel tgz. At least it launched with an error under Wine (dynamic binary), so I can say mingw32 works fine. I tried to the same with Lagrange, but it gave me an error on libUnistring. As the $DISTRO I use didn't provide it as a MinGW package, I gave up.
- trimethylpurine 2y agoI think this headline should read specific to C/C++ for Linux. I'm still not sure that I agree with the above, but I do know for sure I couldn't say this about Python, Java, Go, web, etc. because development on Windows for any of these most popular languages is braindead simple in those cases. In fact it's much easier than setting up in Linux or Mac for the same thing. Especially in a multi platform enterprise environment with lots of security controls and a need for cross platform file sharing. To put this in perspective, this article is a tour of trying to do cross platform development in C/C++ on the only desktop OS that it's reasonable to do that in at all.
- delta_p_delta_x 2y ago> this article is a tour of trying to do cross platform development in C/C++ on the only desktop OS that it's reasonable to do that in at all. This is a superbly succinct take of Windows.
- carom 2y agoI've been developing on Windows the last year and a half. I came from a Linux background and wanted to learn how to use Windows in the same way I used Linux, that is to say, I wanted to avoid finding "bash on Windows" solutions and calling it a day. My advice, install Visual Studio (or just the build tools), fire up the developer command prompt for your architecture, then learn the cl (compiler) and ml (the assembler) command line invocations. Many common Unix commands have an equivalent command prompt command you can learn. It just takes some repetition to remember them. I will be the first to admit, it's very funky. Copy and move have some quirks (use xcopy or robocopy). Batch scripts execute in a really uninituitive way. There are a lot of rough edges but you can develop C and C++ like you would on Linux with a terminal and text editor, it just takes some getting used to.
- tonymet 2y agoA great summary that should encourage more Linux developers to use Windows. Lots of utility with WSL2 and Hyper-V built in, you can run any Linux distro you like with a single click from the MS Store, while enjoying the great performance and UX on Windows 11 (once you turn off the ads -- yeah I know). I use a combination of VS Code with WSL2 Debian -- so it's identical to my prod environment. It's polished, consistent with prod and efficient on my hardware. Compared to the Mac I find the Windows experience to be far better, because of the native Hyper-V VM support, better Linux compatibility with WSL2 and the much more diverse hardware options. The PC ecosystem is incredible. Even the Windows ecosystem is nice, Visual Studio Community is free, the CLI compiler is available, winget makes installs easier, Powershell has a lot of utility and Windows Terminal is excellent. Given that you can pick up a capable mini PC for about $200 , it's worth testing out. Windows is great for Linux development.
- michaelsbradley 2y agoMSYS2 plus its CLANG64 environment is great stuff: https://www.msys2.org/docs/environments/ https://www.msys2.org/docs/environments/
- ryukoposting 2y agoThe author's recommendation of a MinGW-W64 toolchain + Cygwin build utilities is the workflow I followed for several years before moving to MSYS2, before ditching Windows entirely a few months ago. WSL did its job quite well, but asking a user to set up WSL is out of the question. It isn't well-suited for anything a non-technical person might want to touch. One thing the author doesn't make clear is that MinGW-64 does not fully implement a Linux compatibility layer. For example, if you try to use MinGW to compile a program that calls fork(), you're going to have a bad time. That's why Cygwin is still relevant today - its compatibility layer is much more comprehensive than MinGW, at the cost of an extra DLL that has to follow your program around. Also bear in mind that Cygwin has to do some really nasty things [1] to do everything it does. Whenever you run into a situation where the Unix API doesn't align with the Windows view of the universe, Cygwin runs the risk of introducing severe performance issues. [1] https://cygwin.com/cygwin-ug-net/highlights.html https://cygwin.com/cygwin-ug-net/highlights.html
- paul_manias 2y agoI've been using MinGW and MSYS for Windows development since the early 2000's, mainly to keep the build process consistent with Linux. A couple of years ago I gave Visual Studio / MSVC a second chance and have stuck with it ever since. MSVC generates significantly faster & smaller code, doesn't require additional DLLs in the final build, and the C++ compiler behaves predictably. Critically it also works very well with CMake, so my build process is seamlessly aligned with Linux. The VS debugger is a major help too - gdb can do the same stuff, and there are UIs for gdb, but debugging through VS is just more productive and convenient. Times change!
- qwery 2y agoThis article doesn't quite land for me. It could perhaps use an introductory paragraph explaining who it's for / what the goal is. For example, are we trying to build cross-platform software, with a single build system? > If you want to develop C or C++ on Windows, your options get more complicated. This is a weird thing to say. If you want to build software for Windows -- especially so in C or C++! -- your choice is simplified. The best way to build software for Windows is to use Windows tooling. MSVC is excellent at compiling standard portable C and C++ code to a native windows executable. If you write portable code, it will compile with any of the major compiler suites, for any of the platforms they (fully) support.
- majoe 2y agoCygwin is currently the bane of my existence. I'm working on software, that was originally written in CORAL and running on mainframes and then translated to C to run on UNIX. Company policy is, that all programs have to run on Windows, so nowadays we work with Cygwin Don't get me wrong, it works, but there a thousand annoying things, bugs an inconveniences. I'm currently spearheading an effort to migrate to wsl2 (and docker). The developer experience is vastly better on wsl.
- commercialnix 2y agoIf you are going to develop on Windows and you aren't developing for Windows, you are what the construction and film production industries call "green".
- drillsteps5 2y agoThe better name of the article would be "What to do if you only developed in Linux and now need to develop under Windows but are too lazy to learn the tools and best practices within Windows ecosystem". There's also much simpler way - spin up a VM with Linux and continue developing there. Or you can, you know, learn to develop with Visual Studio, Azure, and entire development ecosystem built by MSFT in the last few decades. And btw Git might have been built by Torvalds but GitHub is owned by Microsoft :)
- CRConrad 2y ago> And btw Git might have been built by Torvalds but GitHub is owned by Microsoft :) Yeah. That's why you should use one, but not the other.
- CLiED 2y agoJust download the latest visual studio, no need for gimmicks or trying to reproduce the unix dev experience on windows, just embrace the platform, warts and all, and call it a day.