Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Because cross-compiling binaries for Windows is easier than building natively

Because cross-compiling binaries for Windows is easier than building natively

I want Microsoft to do better, want Windows to be a decent development platform-and yet, I constantly see Microsoft playing the open source game: advertising how open-source and developer friendly they are - only to crush developers under the heel of the corporate behemoth's boot.

The people who work at Microsoft are amazing, kind, talented individuals. This is aimed at the company's leadership, who I feel has on many occassions crushed myself and other developers under. It's a plea for help.

The source of truth for the 'open source' C#, C++, Rust, and other Windows SDKs is proprietary

You probably haven't heard of it before, but if you've ever used win32 API bindings in C#, C++, Rust, or other languages, odds are they were generated from a repository called microsoft/win32metadata.

Unfortunately, the source of truth for these generated SDKs - the Windows SDK .idl files - are proprietary despite living in the same repository with only an MIT license at the root.

Are derived community works, like say the D-language, Dart, or Zig bindings to the win32 API which are generated from those files open source - if Microsoft did not release them as such? I'll let you decide.

Azure Kinect DK is not open source

If you're one of the unlucky few who spent a few hundred dollars on an Azure Kinect developer kit, eyes shimmering with possibility and staring at that totally open-source microsoft/Azure-Kinect-Sensor-SDK repository - it was perhaps short lived.

Unfortunately, the Body Tracking SDK is a proprietary binary blob - so if you were looking to improve upon the body tracking, add ARM CPU support, get it working on Linux, or anything else - you're out of luck.

.NET is not an open

As covered in isdotnetopen.com, despite best efforts .NET is still not an open platform:

  • ramming in a proprietary extension to continue to lockdown .NET.
  • an open programming language is missing a debugger
  • leadership decision to remove hotreload angers community and devdiv employees

I'm still blown away that they literally made the .NET team revert the dotnet watch PR at the last minute, so that they could sell it as a feature.

VS Code is marketed as open source, but it's not

The messaging around VS Code is clear, albeit a bit slippery, about being open source:

Visual Studio Code - Open Source ("Code - OSS")

This project has adopted the Microsoft Open Source Code of Conduct.

Free. Built on open source.

Meanwhile:

Side note: If you're making VS Code extensions, please also publish them to open-vsx.org as Microsoft has sent cease-and-desists to those who use their extension registry outside of the VS Code product, so it cannot be used in the open-source fork vscodium.

I'm fine with proprietary software, but stop labeling it as "Made with natural ingredients."

It's not the fact that this software is proprietary that bothers me. I live with and use proprietary software daily. I'm not some purist.

What bothers me is that Microsoft pushes the idea these projects are open source, hosts them on GitHub, only has MIT licenses in the repositories, and doesn't mention it anywhere.

Then someone who actually cares digs in, only to find hidden proprietary binary blobs and closed GitHub discussions concluding 'legal said no, we won't change the license'

"Made with natural ingredients." is what it feels like. And I understand why they do it, too, how many people would eat the VS Code cereal if it read:

VS Code! A proprietary editor from Microsoft Corp! download now!

Windows development is broken (symlinks)

While I'm airing all of my greviences, I've been writing a game engine, Mach, in Zig for the past year. You know what Windows developers constantly complain to me about?

I tried it. It says the file doesn't exist

I point them to our FAQ, which gives two options:

  1. Option 1: Fix Windows
    1. Enable "Developer Mode" (warning: this turns on symlinks, which Microsoft says are a security risk)
    2. Enable symlinks in Git (Developer Mode is not enough.) git config --global core.symlinks true
    3. Retry
  2. Option 2: Cross-compile from WSL -> Windows using zig build -Dtarget=x86_64-windows

Because somehow in 2022 cross-compiling Windows native binaries from Linux is easier than building on Windows natively.

I wish that was the end of the Windows developer pain story

  • Long file paths: Azure, OpenSearch, and ~90 other open source projects have to document how to enable long file paths on Windows because the default is a ~255 character limit.
  • CRLF: (Also, you know to configure core.autocrlf right?)
  • PowerShell ... BTW, Windows 10 ships with an outdated PowerShell version in which HTTP file downloadsare ~122x slower, you know you were supposed to update that out-of-band, right? Because Windows Update won't do that for you.

What does Developer Mode in Windows do again?

My plea to Microsoft

Again, the people who work at Microsoft are amazing, kind, talented individuals. I have no issues with you, I'm sure you are fighting the Microsoft behemoth in the same way to improve developer's lives.

I beg of Microsoft to do the following:

(1) Stop hiding proprietary code in 'open-source' GitHub repositories

It's not in the spirit of open source. It feels like code "Made with natural ingredients." only to find a plutonium core. If the license says MIT, it shouldn't contain proprietary source code.

Enact a policy to never put proprietary code on GitHub. Have it clearly stated in the README when a project contains proprietary code, or depends on substantial proprietary code to be used effectively.

I'm tired of finding this out through closed GitHub issues.

(2) Fix Developer Mode on Windows

I'm just trying to reiterate that real people are facing the issues I described above. They don't constantly raise these through your Feedback Hub where you can count them because, surprise! They just expect Windows development to be painful like this and expect to have to Google workarounds 24/7.

Here's how you can fix this:

If someone installs or launches developer tools (WSL, VS Code, Git, PowerShell, etc.) then prompt them to enable Developer Mode.

It's insane you can be using these tools, developing on Windows, without any knowledge a 'developer mode' exists. It's almost impossible to develop on a Mac without knowing about XCode.

If you turn on Developer Mode, have Clippy pop up and prompt the user:

Do you want me to enable symlinks (warning: this is a security risk)?

Do you want me to update PowerShell? (or stick with the multiple years-old version where file downloads are ~122x slower?)

Do you want me to enable file paths >255 characters? (warning: may break file explorer and other apps)

Do you want me to install Git?"

Do you want me to configure Git to use long file paths?

Do you want me to configure Git to use symlinks?

Do you want me to configure core.autocrlf?

Problem solved!

Thanks

Again, I've no qualms with the people spending their diligent efforts trying to improve Microsoft/Windows. This is feedback, I hope you'll direct it to the right people.

You can find me on Twitter @slimsag in case you need to send the Clippy hit squad.

@nblack33-acc
Copy link

nblack33-acc commented Jun 17, 2022

Good post. Most of this, I can imagine they have some weak opposing argument, except this;

Because somehow in 2022 cross-compiling Windows native binaries from Linux is easier than building on Windows natively.

I have no idea how MS thinks that makes sense. Why is it like this? How have they not been working on this, shouldn't it be priority #1? Do the devs at MS do their Windows dev work, in Windows?

@seyed-dev
Copy link

seyed-dev commented Jun 17, 2022

👍

@sharpobject
Copy link

sharpobject commented Jun 17, 2022

It's almost impossible to develop on a Mac without knowing about XCode.

This is a bad thing, right? Like, people know about XCode because they have to use xcode-select before they can build stuff, or because they owe a $100 tithe or whatever.

@StephenHodgson
Copy link

StephenHodgson commented Jun 17, 2022

Same exact problem with the holotoolkit/mixed reality toolkit.

I spent oner 5 years working on that project for free only for them to swoop in and take it over once it got popular 😏

@MrAndrew
Copy link

MrAndrew commented Jun 17, 2022

Also, please don't kill Atom. Create an ARM version instead.

@marco-trovato
Copy link

marco-trovato commented Jun 17, 2022

Nowadays everyone loves them, but unfortunately they will never change.

@riverar
Copy link

riverar commented Jun 18, 2022

Unfortunately, the source of truth for these generated SDKs - the Windows SDK .idl files - are proprietary despite living in the same repository with only an MIT license at the root.

Be aware GitHub does not support specifying more than one license at a time. It's true the convenience copy of SDK files in the repository are proprietarily licensed but... why would anyone care? The permissively-licensed metadata output (and tooling) is the product!

Are derived community works, like say the D-language, Dart, or Zig bindings to the win32 API which are generated from those files open source - if Microsoft did not release them as such? I'll let you decide.

The win32metadata is produced by Microsoft and is openly licensed MIT. What license affixed to Microsoft-owned goop it was derived from is wholly irrelevant and is not transitive to its own derived works.

@Trumeet
Copy link

Trumeet commented Jun 18, 2022

Also, as a POSIX developer, building Win32 binaries with the MinGW toolchain on a Unix system is much much simpler than downloading and installing and using all the Visual Studio toolchains.

@LayZeeDK
Copy link

LayZeeDK commented Jun 18, 2022

Be aware GitHub does not support specifying more than one license at a time.

As of a month ago, it does.

@riverar
Copy link

riverar commented Jun 18, 2022

Be aware GitHub does not support specifying more than one license at a time.

As of a month ago, it does.

Wow, thanks, has been a long standing request and I missed the debut. Will go take advantage of this right now.

@slimsag
Copy link
Author

slimsag commented Jun 18, 2022

@riverar I appreciate you taking the time to respond, just want to highlight again, this is not targeted at you / any individual. I hope there's no animosity over the rant I've written here.

It's true the convenience copy of SDK files in the repository are proprietarily licensed but... why would anyone care? The permissively-licensed metadata output (and tooling) is the product!

The beauty of open source is in being able to modify and build upon works. But this isn't some theoretical "I love FOSS" thing, I can give you a concrete example of why myself and others care here.

Because those IDL files were in the repository, I myself and others were under the impression they were MIT licensed (that's what the LICENSE file said, after all, until it was later stated to not be the case in the GitHub issue.)

I spent weeks personally investigating whether or not we could use those IDL files to improve the accuracy of Wine's IDL files, which are consumed by numerous open source projects (MinGW, Proton from Valve, and the Zig programming language.)

I'm not the only one, either: the person who opened the issue asking for clarification on the license is a Wine core developer who was considering using these files. The Zig win32 bindings linked in the win32metadata repository README were written by someone who later said we need the IDL files to properly recreate the headers (because the JSON is not sufficient).

You can also find numerous instances of where individuals working on Proton spend countless hours recreating the IDL files for DirectX headers.

It's fine that Microsoft doesn't want to open source these, it just means others will spend the countless hours to recreate them without a proprietary license (because distributing the Windows SDK is a pain, and a licensing nightmare, especially on non-Windows platforms.) But it would've been good to have it be much more clear from the get-go that those files were indeed not MIT licensed.

That's why anyone would care. Hope that makes sense.

@riverar
Copy link

riverar commented Jun 18, 2022

@slimsag No offense taken, will get that README updated and pepper in some files to light up GitHub. I recognize the repository MIT license currently appears as quite the honey pot to the developers you listed above.

@slimsag
Copy link
Author

slimsag commented Jun 18, 2022

Appreciate you!

@z-ph0ria
Copy link

z-ph0ria commented Jun 18, 2022

m$ once again nutshelled, past prooves present.

@StoneCypher
Copy link

StoneCypher commented Jun 19, 2022

you can have symbolic links in windows without developer mode, and it doesn't really take much effort to learn how. lots and lots of software is built this way

@tbodt
Copy link

tbodt commented Jun 19, 2022

Could you write a script that inverts the generation of C++ (or pick your language) bindings from the .idl files and produces output that's functionally identical to the original .idl files?

@ClosetBugSlayer
Copy link

ClosetBugSlayer commented Jun 21, 2022

Microsoft only responds to credible ultimatums, not threats to leave to Linux. Those haven't worked in 20 years. They don't care if you do that because they ultimately control the Linux bootloader's ability to load. As you can see, the bugs in recent Microsoft software combined with the onslaught of political SJW nonsense in business software is so obnoxious that it is a clearly intentional attack on fiduciary duty that can be prosecuted under federal law. Stockholders need to identify and remove the agent provocateurs, starting with Satya himself. It all started under him. Antitrust is still a thing and one person can bring it all down.

@phpfui
Copy link

phpfui commented Jun 23, 2022

How about just not using MS CR*P? It changes constantly. Not worth the hassle.

@rfaile313
Copy link

rfaile313 commented Jun 23, 2022

👏 well said

@decuser
Copy link

decuser commented Jun 23, 2022

It's almost impossible to develop on a Mac without knowing about XCode.

This is a bad thing, right? Like, people know about XCode because they have to use xcode-select before they can build stuff, or because they owe a $100 tithe or whatever.

Nah, it's just what it is - to do pretty much any development on Mac, you need the Mac developer tools installed (duh). The differences here are manifest - Windows doesn't have a set of coherent developer tools, a rational developer mode, or support for development. Everything is ala carte and with a complete mish-mash of support.

Oh, and XCode costs $0. The paid developer account is not necessary for anything, other than perhaps to publish an app, in the app store. You don't need any dev account to access XCode. The free account is useful to gain access to the developer downloads page, documentation, etc. from a central location.

@andrewathalye
Copy link

andrewathalye commented Jun 24, 2022

Here is another interesting case. If I want to bootstrap a tool chain on Windows, for example the latest GCC suite with Ada or Go support, I will likely have an easier time cross-compiling it from Linux than trying to somehow build it using MSVC or get an existing bootstrap build. Especially for things like Rust, where you are expected to have a working rustc to build it, this is a pretty big issue.

@russeg
Copy link

russeg commented Jun 24, 2022

For Microsoft, open source is a business model not a philosophy. Same goes for most companies and individuals (ie: asking for donations or funding). Spirit of open source is long dead.

@codewrangler1
Copy link

codewrangler1 commented Jun 24, 2022

Windows 10? Why not run Windows 11?

@pohlt
Copy link

pohlt commented Jun 26, 2022

Good article and I agree (except for the fact that plutonium is quite a natural ingredient ;-P).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment