Remix.run Logo
I Fixed Windows Native Development(marler8997.github.io)
174 points by deevus 3 hours ago | 74 comments
tgtweak 10 minutes ago | parent | next [-]

Toolchains on linux are not clear from dependency hell either - ever install an npm package that needs cmake underneath? glibc dependencies that can't be resolved because you need two different versions simultaneously in the same build somehow... python in another realm here as well. That shiny c++ project that needs a bleeding edge boost version that is about 6 months away from being included in your package manager. Remember patching openSSL when heartbleed came around (libssHELL).

Visual studio is a dog but at least it's one dog - the real hell on windows is .net framework. The sheer incongruency of what version of windows has which version of .net framework installed and which version of .net your app will run in when launched... the actual solution at scale for universal windows compatibility on your .net app is to build a c++ shim that checks for .net beforehand and executes it with the correct version in the event of multiple version conflict - you can literally have 5 fully unique runtimes sharing the same .net target.

giancarlostoro 3 minutes ago | parent [-]

I went from POP OS (Ubuntu) to EndeavourOS (Arch) Linux because some random software with an appimage or whatever refused to run with Ubuntus “latest” GLIBC and it ticked me off, I just want to run more modern tooling, havent had any software I couldnt just run on Arch, going on over a year now.

dgxyz 2 hours ago | parent | prev | next [-]

This is harder than what I do. Just install LTSC Visual Studio build tools from [1], then chuck this in a cmd file:

    cl yourprogram.c /link user32.lib advapi32.lib ... etc etc ...
I've built a load of utilities that do that just fine. I use vim as an editor.

The Visual Studio toolchain does have LTSC and stable releases - no one seems to know about them though. see: https://learn.microsoft.com/en-gb/visualstudio/releases/2022... - you should use these if you are not a single developer and have to collaborate with people. Back like in the old days when we had pinned versions of the toolchain across whole company.

[1] https://download.visualstudio.microsoft.com/download/pr/5d23...

aleph_minus_one an hour ago | parent [-]

> The Visual Studio toolchain does have LTSC and stable releases - no one seems to know about them though.

You only get access to the LTSC channel if you have a license for at least Visual Studio Professional (Community won't do it); so a lot of hobbyist programmers and students are not aware of it.

On the other hand, their existence is in my experience very well-known among people who use Visual Studio for work at some company.

dgxyz an hour ago | parent [-]

You can install the LTSC toolchain without a license. Just not the IDE.

foepys 39 minutes ago | parent [-]

That's not correct. You don't have to give your credit card details or even be logged in but you are still required to have any Visual Studio license. For hobbyists and startups the VS Community license is enough but larger companies need a VS Professional license even for the VS Build Tools.

How strict Microsoft is with enforcement of this license is another story.

dgxyz 30 minutes ago | parent [-]

Fair. Although I tend not to give a crap about Microsoft licensing :)

okanat 18 minutes ago | parent [-]

Well, let's say this is the world view of all companies about open-source software. Then what happens. If people "tend to not give crap" about licenses, all the nice guarantees of GPL etc also disappear.

jjkaczor 29 minutes ago | parent | prev | next [-]

While this is great - Visual Studio installer has a set of "command-line parameters" for unattended installs.

You can then build a script/documentation that isolates your specific requirements and workloads:

https://learn.microsoft.com/en-us/visualstudio/install/use-c...

Had to do this back in 2018, because I worked with a client with no direct internet access on it's DEV/build machines (and even when there was connectivity it was over traditional slow/low-latency satellite connections), so part of the process was also to build an offline install package.

jezek2 4 minutes ago | parent | prev | next [-]

I wish open source projects would support MingW or at least not actively blocking it's usage. It's a good compiler that provides an excellent compatibility without the need of any extra runtime DLLs.

I don't understand how open source projects can insist on requiring a proprietary compiler.

evanjrowley 7 minutes ago | parent | prev | next [-]

Alternatively, there's this:

Install Visual Studio Build Tools into a container to support a consistent build system | Microsoft Learn

https://learn.microsoft.com/en-us/visualstudio/install/build...

ivanjermakov 22 minutes ago | parent | prev | next [-]

One day I decided to port my text editor to Windows. Since it depends on pcre2 and treesitter, these two libraries had to be provided by the system.

In the span of ~2hrs I didn't manage to find a way to please Zig compiler to notice "system" libraries to link against.

Perhaps I'm too spoiled by installing a system wide dependency in a single command. Or Windows took a wrong turn a couple of decades ago and is very hostile to both developers and regular users.

lmz 2 minutes ago | parent [-]

If you depend on a library and can't figure out how you would compile against it, it's probably better for the end user that you don't make anything because you'll still need to package it up later unless you link statically.

its_notjack 44 minutes ago | parent | prev | next [-]

Is this post AI-written? The repeated lists with highlighted key points, the "it's not just [x], but [y]" and "no [a] just [b]" scream LLM to me. It would be good to know how much of this post and this project was human-built.

botusaurus 2 minutes ago | parent | next [-]

you know why LLMs repeat those patterns so much? because that's how real humans speak

evanjrowley 16 minutes ago | parent | prev | next [-]

Perhaps people have mimicked the style because LLMs have popularized it and clearly it serves some benefit to readers.

mkoubaa 11 minutes ago | parent [-]

Life imitates art, even when that art is slop

esseph 16 minutes ago | parent | prev | next [-]

> Is this post AI-written?

What if it was?

What if it wasn't?

What if you never find out definitely?

Do you wonder that about all content?

If so, doesn't that get exhausting?

efilife 4 minutes ago | parent | prev [-]

I'm so fucking tired of this

torginus 28 minutes ago | parent | prev | next [-]

What we did for out build agents was to just install the required version of build tools via chocolatey. But cool approach!

MomsAVoxell 10 minutes ago | parent [-]

Same. Choco solves this with a one-liner for me.

g947o 44 minutes ago | parent | prev | next [-]

* Is this allowed per VS' ToS?

* I wonder if Microsoft intentionally doesn't provide this first party to force everyone to install VS, especially the professional/enterprise versions. One could imagine that we'd have a vsproject.toml file similar to pyproject.toml that just does everything when combined with a minimal command line tool. But that doesn't exist for some reason.

BearOso 17 minutes ago | parent | next [-]

Microsoft doesn't seem to care unless you're a company. That's the reason community edition is free. Individual licenses would be pennies to them, and they gain more than that by having a new person making things in their ecosystem. It's in their interest to make their platform accessible as possible.

Uvix 21 minutes ago | parent | prev [-]

Visual Studio does have that functionality, via vsconfig files: https://learn.microsoft.com/en-us/visualstudio/install/impor...

g947o 19 minutes ago | parent [-]

Doesn't look like it's versioned, or installs Visual Studio itself.

jordand 11 minutes ago | parent | prev | next [-]

For big C++ projects, the .vsconfig import/export way of handling Visual Studio components has worked well for the large teams I'm on. Tell someone to import a .vsconfig and the Visual Studio Installer does everything. Only times we've had issues is from forgetting to update it with components/SDK changes.

claimred 7 minutes ago | parent | prev | next [-]

Perhaps winget is enough?

winget install Microsoft.VisualStudio.2022.BuildTools

debugnik 4 minutes ago | parent [-]

The Build Tools installer first installs the Visual Studio tool to select the workloads you want as well.

ww520 33 minutes ago | parent | prev | next [-]

I was just setting up a new machine and was setting up the Rust environment. The very first thing rustup-init asked was to install Visual Studio before proceeding. It was like 20-30gb of stuff installed before moving forward.

This tool would be a great help if I knew beforehand.

droelf 11 minutes ago | parent | prev | next [-]

Thank you, this might be a great way to improve the developer experience in the conda/conda-forge ecosystem.

6581 an hour ago | parent | prev | next [-]

> No Visual Studio installation. No GUI. No prayer. Just a script that does exactly what it says.

never_inline an hour ago | parent [-]

Yeah its obvious clanker writing. I don't even mind using LLM for code but this rubs the wrong way.

xvilka an hour ago | parent | prev | next [-]

Please add also the support for the clang-cl[1][2].

[1] https://clang.llvm.org/docs/MSVCCompatibility.html

[2] https://clang.llvm.org/docs/UsersManual.html#clang-cl

criemen 2 hours ago | parent | prev | next [-]

This is amazing.

At $workplace, we have a script that extracts a toolchain from a GitHub actions windows runner, packages it up, stuffs it into git LFS, which is then pulled by bazel as C++ toolchain.

This is the more scalable way, and I assume it could still somewhat easily be integrated into a bazel build.

dgxyz an hour ago | parent [-]

Keeping CI entirely out of windows desktop development is the biggest efficiency and cost improvement I've seen in the last 15 years. Our CI toolchain broke so we moved back to a release manager doing it manually. It takes him 20x less time to build it and distribute it (scripted) than it does to maintain the CI pipeline and his desktop machine is several times faster than any cloud CI node we can get hold of.

Edit: Uses a shit load less actual energy than full-building a product thousands of times that never gets run.

pjmlp 2 hours ago | parent | prev | next [-]

It starts by not looking into Windows through UNIX developer glasses.

The only issue currently plaguing Windows development is the mess with WinUI and WinAppSDK since Project Reunion, however they are relatively easy to ignore.

jasode an hour ago | parent | next [-]

>It starts by not looking into Windows through UNIX developer glasses.

People don't need any UNIX biases to just want multiple versions of MSVS to work the way Microsoft advertises. For example, with every new version of Visual Studio, Microsoft always says you can install it side-by-side with an older version.

But every time, the new version of VS has a bug in the install somewhere that changes something that breaks old projects. It doesn't break for everybody or for all projects but it's always a recurring bug report with new versions. VS2019 broke something in existing VS2017 installs. VS2022 broke something in VS2019. etc.

The "side-by-side-installs-is-supposed-to-work-but-sometimes-doesn't" tradition continues with the latest VS2026 breaking something in VS2022. E.g. https://github.com/dotnet/sdk/issues/51796

I once installed VS2019 side-by-side with VS2017 and when I used VS2017 to re-open a VS2017 WinForms project, it had red squiggly lines in the editor when viewing cs files and the build failed. I now just install different versions of MSVS in totally separate virtual machines to avoid problems.

I predict that a future version VS2030 will have install bugs that breaks VS2026. The underlying issue that causes side-by-side bugs to re-appear is that MSVS installs are integrated very deeply into Windows. Puts files in c:\windows\system32, etc. (And sometimes you also get the random breakage with mismatched MSVCRT???.DLL files) To avoid future bugs, Microsoft would have to re-architect how MSVS works -- or "containerize" it to isolate it more.

In contrast, gcc/clang can have more isolation without each version interfering with each other.

I'm not arguing this thread's msvcup.exe tool is necessary but I understand the motivations to make MSVS less fragile and more predictable.

torginus 32 minutes ago | parent [-]

Note that this also doesn't work on Linux - your system's package manager probably has no idea how to install and handle having multiple versions of packages and headers.

That's why docker build environments are a thing - even on Windows.

Build scripts are complex, and even though I'm pretty sure VS offers pretty good support for having multiple SDK versions at the same time (that I've used), it only takes a single script that wasn't written with versioning in mind, to break the whole build.

skissane 23 minutes ago | parent [-]

> Note that this also doesn't work on Linux - your system's package manager probably has no idea how to install and handle having multiple versions of packages and headers.

But this isn’t true. Many distros package major versions of GCC/LLVM as separate packages, so you install and use more than one version in parallel, no Docker/etc required

It can indeed be true for some things-such as the C library-but often not for the compilers

dgxyz an hour ago | parent | prev [-]

Yes. Any user interface toolkit that isn't at least 10 years old should be ignored on windows unless you want to rewrite everything one day.

viraptor an hour ago | parent | next [-]

Why? You may end up with something that doesn't get much attention anymore, but none of the official gui approaches have ever been removed as far as I know. Win32, MFC, winforms, wpf, winui, maui are all still available and apps using them are functional. Even winjs still works apparently, even if it was handed over.

I wouldn't start an app in most of them today, but I wouldn't rewrite one either without a good reason.

dgxyz an hour ago | parent [-]

Well a number of them have horrific bugs in them which have zero attention. At least win32 has an abstraction level which allows you to work around them.

There’s a fun bug on WPF and form backgrounds for example which means on fractional DPI screens the background is tiled unpredictably. Had to patch that one up rather quickly one day and it was a mess due to how damn complicated WPF is.

glimshe an hour ago | parent | prev [-]

I wonder if people still use WinForms, MFC and WPF...

shigawire an hour ago | parent | next [-]

Still migrating an enterprise app off WPF to this day.

dgxyz an hour ago | parent [-]

What are you moving to out of interest? I’ve seen people talking of moving ours to Electron which seems to just be more problems waiting.

dgxyz an hour ago | parent | prev | next [-]

We still use win32!

(granted we made our own MFC around it)

pjmlp an hour ago | parent | prev [-]

They certainly do.

jevinskie 17 minutes ago | parent | prev | next [-]

Were you around before the new installer came out? It was light speed compared to what was before!

reactordev 2 hours ago | parent | prev | next [-]

And here I was messing with MingW64…

This is fantastic and someone at Microslop should take notes.

Borg3 an hour ago | parent [-]

Exacly.. I avoid Visual Studio.. I try to build everthing using Mingw..

xvilka an hour ago | parent [-]

Clang is the better alternative to MinGW because it can use standard Windows libraries and avoids the need for additional runtime.

jezek2 10 minutes ago | parent | next [-]

I use MingW without any extra libs (no msys), it just uses the ancient msvcrt.dll that is present in all Windows versions, so my programs work even on Windows 2000.

Additionally the cross-compiler on Linux also produces binaries with no extra runtime requirements.

okanat 4 minutes ago | parent [-]

You can use Mingw-w64 UCRT or CLANG environments that come with MSYS2.

Compared to older Mingw64 environments those link with the latest UCRT so you get almost the same style executable as Visual Studio.

The only difference for C is that it uses Mingw exception handling and global initialization code, and it uses Itanium ABI for C++.

dwroberts 26 minutes ago | parent | prev | next [-]

Can you actually do cross compilation (on Linux host to win64 binary) with clang in the same way as MingW does out of the box though?

okanat 9 minutes ago | parent [-]

No. You cannot even do direct compilation on the same host and target with clang only.

LLVM doesn't come with the C library headers (VCRuntime) or the executable runtime startup code (VCStartup).Both of which are under Visual Studio proprietary licenses. So to use Clang on Windows without Mingw, you need Visual Studio.

reactordev 42 minutes ago | parent | prev [-]

Just msys2 it all

delta_p_delta_x 31 minutes ago | parent [-]

MSYS2 is horrible. It brings a massive runtime environment and is a bad idea to foist on users.

mkoubaa 10 minutes ago | parent | prev | next [-]

Say what you want about coding agents, when the cost of writing code goes to near-zero, the cost of wrangling tools becomes a much bigger fraction of development effort. This is an amazing opportunity to address long-standing frictions.

rzr an hour ago | parent | prev | next [-]

next, wrap it with wine and eventually share a bottle/winetrick

NSUserDefaults an hour ago | parent | prev | next [-]

So this fixes the problem when msvc is the required compiler. Does the zig C++ compiler bring anything to the table when clang is an option?

feverzsj an hour ago | parent [-]

You still need headers and libraries that ship with MSVC.

ewuhic an hour ago | parent | prev | next [-]

Nix on Windows when...

PlatoIsADisease 29 minutes ago | parent | prev | next [-]

I havent run into this problem yet... but my oldest .net software is only 1 year old... Is this something that happens over the course of a few years?

__alexander an hour ago | parent | prev | next [-]

Another option is explore winget and chocolaty. Most build tools and compilers can be installed via the command line on windows. Ask your favorite LLM to create a powershell script to install them all.

jen20 2 hours ago | parent | prev | next [-]

This is a serious quality of life improvement for people forced to deal with Windows! Great job.

thrownaway561 36 minutes ago | parent | prev | next [-]

I'm just asking, but is there really a need for a native programs anymore? Where I worked a decade ago, we started porting all our native programs over to the browser and this was when MVC beta was just being released. At this point with Electron and Tauri, is there even a need to write a native program

Now with AI, I would think that porting a native program to the browser wouldn't be the chore it once was.

MomsAVoxell 6 minutes ago | parent | next [-]

Yes, very definitely. There has always been a need for high performance native applications. Even in the beginning of the desktop computing revolution, these questions have been asked .. and yes, there is a balance between native and cloud/browser-based computing - some of it is personal, much of it is industrial and corporate, and yet more of the spectrum where both methods are applicable exists, even still, decades later.

well_ackshually 13 minutes ago | parent | prev | next [-]

> is there really a need for a native programs anymore

As long as you don't give a shit about the fact that your baseline memory consumption is now 500MB instead of 25MB, and that 80% of your CPU time is wasted on running javascript through a JIT and rendering HTML instead of doing logic, no.

If you don't give a shit about your users or their time, there's indeed no longer a need to write native programs.

PlatoIsADisease 29 minutes ago | parent | prev [-]

I use COM and DLLs to extend software/automate. Using Visual Studio gives me some really nice debugging options.

I did try using python and js but the variable explorer is garbage due to 'late binding'.

I thought this was just my ignorance, but I've asked experts, AI, and google searched and they unfortunately agree. That said, some people have created their own log/prints so they don't need to deal with it.

eptcyka an hour ago | parent | prev | next [-]

Is this even legal?

Philpax an hour ago | parent | prev [-]

At the risk of being that guy, I haven't had any issues onboarding people onto native projects written in Rust. rustup does a great job of fetching the required toolchains without issue. I'd imagine the same is also true of Go or Zig.

g947o 35 minutes ago | parent | next [-]

I'm pretty people who write and build C++ on Windows do it for good reasons, often reasons that are out of their control. Your comment is not going to make any difference.

ww520 42 minutes ago | parent | prev | next [-]

Before rustup can run, the very first message rustup-init spits out is asking to install the visual studio tool chain.

the__alchemist an hour ago | parent | prev [-]

You have to do this for certain rust things too. I can't remember which, but I inevitably run into a need to install the MSVC toolchain to compile rust. I think it might be related to FFI, or libs which use FFI? The same thing comes up in Linux, but the process to install it is different.

I got anxiety reading the article, describing exactly why it sucks. It's nice to know from the article and comments here there are ways around it, but the way I have been doing it was the "hope I check the right checkboxes and wait a few hours" plan. There is usually one "super checkbox" that will do the right things.

I have to do this once per OS [re]install generally.