Live data from Hacker News

Cross-compiling binaries for Windows is easier than building natively

gist.github.com

41–50 of 349 posts

Re: Cross-compiling binaries for Windows is easier than building natively

#41
post #5

Microsoft's days as a 'primary' desktop operating system are numbered. The OP doesn't seem to understand this, but even Microsoft itself does, which is why most of its major moves the past few years haven't been improving its own desktop, but positioning itself to control "open source" the best it can. More people within the MS ecosystem should understand this.

Better check those desktop market share numbers.

Re: Cross-compiling binaries for Windows is easier than building natively

#42

Earlier quoted context omitted.

That's exactly it. Windows developers know NTFS has Symbolic Links https://docs.microsoft.com/en-us/windows/win32/fileio/creati...

What's the standard for being an "actual Windows user"? Asking because I doubt e.g. my mom knows that NTFS has symlinks.

Is she a Windows developer?

https://docs.microsoft.com/en-us/windows-server/administrati...

Re: Cross-compiling binaries for Windows is easier than building natively

#43

Earlier quoted context omitted.

There are very few things that actually require Visual Studio just to build.

Interesting, how can I install just the cmake + msvc to do command line builds with windows? I'm also installing wsl2 + mingw because it is so much lighter for compilation than many, many gigabytes of vis studio.

Download the build tools[0] and choose the appropriate options. I'd personally consider the following a good baseline: MSVC v143, CMake tools, Windows 11 SDK, Clang tools (if you don't want/need these you can shave off 3.5 GB). `zig cc` is another interesting alternative, it's just a single ~62 MB download.

[0] https://visualstudio.microsoft.com/downloads/#build-tools-fo...

Re: Cross-compiling binaries for Windows is easier than building natively

#44
post #21

For me SDK sizes are showstopper. Mingw packages are probably 100-200 Mb total. To build anything native one has to install Windows (20+Gb in modern version and then Visual Studio 40+Gb). Not so easy to fit it all on an SSD drive. Xcode also have this problem now. 8Gb for Xcode 7 is manageable. But why 70Gb for Xcode 11?

I'm cross-compiling Mach engine[0] with Zig, it ends up being a quite small toolchain to cross-compile a game engine (using DirectX, Vulkan, OpenGL, and Metal on respective platforms) from any OS. The Zig toolchain is:

    * Windows: 61 MiB
    * Linux (x86): 49 MiB
    * macOS (x86): 42 MiB
    * macOS (arm): 38 MiB
Zig provides almost everything that is needed to cross compile to those same targets out of the box, including libc and some system libraries. Except macOS frameworks and some updated DirectX headers/libraries (provides MinGW ones), which we bundle and ship separately:

    * Windows: 7 MiB (updated D3D12 headers & libs)
    * MacOS: 112 MiB (almost all frameworks provided by XCode, for x86+arm+iOS)
    * Linux (x86): 22 MiB (x11/wayland headers & libs)
    * Linux (arm): 15 MiB
That's full cross compilation of WebGPU GUI applications to all desktop platforms in under ~217 MiB for most platforms.

[0] https://machengine.org

Re: Cross-compiling binaries for Windows is easier than building natively

#45
post #14

It is. I generate the Windows executables for a program by cross-compiling Rust on Linux. Then test with Wine. The Rust crates are cross-platform enough that I don't have to special case platforms. This is easier than having a Windows machine. The only current headache is that there's no pure Rust bundler, to make ".msi" or ".msix" installer files. If you dump the legacy OS stuff, it gets easier.

I did a similar thing, but I only ever compiled windows versions using Github actions.

Re: Cross-compiling binaries for Windows is easier than building natively

#46
post #28
post #21

For me SDK sizes are showstopper. Mingw packages are probably 100-200 Mb total. To build anything native one has to install Windows (20+Gb in modern version and then Visual Studio 40+Gb). Not so easy to fit it all on an SSD drive. Xcode also have this problem now. 8Gb for Xcode 7 is manageable. But why 70Gb for Xcode 11?

A 1tb M.2 drive is what... £70? If that's out of reach im not sure how you're powering your dev machine.

It’s not bleeding edge raytracing stuff. “Get better hardware” is far from appropriate response.

Re: Cross-compiling binaries for Windows is easier than building natively

#47
post #20

> 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? Certainly. The source for these bindings is the WinMD file, which is MIT licensed. While it is true that its contents are generated wholly from non-FOSS sources, it doesn't impact end users of the metadata. Microsoft owns the origi…

[deleted]

Re: Cross-compiling binaries for Windows is easier than building natively

#48
post #34

Earlier quoted context omitted.

> To build anything native one has to install Windows (20+Gb in modern version and then Visual Studio 40+Gb). Not so easy to fit it all on an SSD drive. Maybe a decade ago, but SSDs are so much cheaper per GB nowadays. Around $0.11/GB. Pretty sure that's cheaper than the first 1TB HDD I've owned.

Not when you are on Macbook. Don't suggest external drives please ;)

I thought apple computers usually had thunderbolt ports. You can't just connect a thunderbolt/M.2 drive enclosure and mount it as root?

Re: Cross-compiling binaries for Windows is easier than building natively

#49

This what is called in Cognitive Behavioral Therapy "All or Nothing Thinking." Microsoft is a for-profit company. It is pro open-source when it helps them and closed source also when it helps them. I like the new Microsoft which has open sourced a lot of stuff. It's way better than the old closed source regime.

Oh, you and the article's author are either forgiven or seeing the best in people. Me, on the other hand, who lived the Microsoft with their shady dealings in Bill's / Ballmer's era, I remember their crushing on OEM's to not allow even a shred of openness in their systems. Only because of shifting in developer's in favor of Apple's / Google's Microsoft changed the tune with "Microsoft loves Linux". Bleah! I have no love for Microsoft despite my work involving their products 90% of my time. I am just realistic, they just love money, nothing else. And if money means open source, guess what?! They bought GitHub and they own everything that is published there. That's why plenty left GitHub and either started their own venture or went to GitLab.

Sorry for my rant, I had to get it off my chest.

Re: Cross-compiling binaries for Windows is easier than building natively

#50
post #21

For me SDK sizes are showstopper. Mingw packages are probably 100-200 Mb total. To build anything native one has to install Windows (20+Gb in modern version and then Visual Studio 40+Gb). Not so easy to fit it all on an SSD drive. Xcode also have this problem now. 8Gb for Xcode 7 is manageable. But why 70Gb for Xcode 11?

Visual Studio's install size is highly dependent on what you install. The minimum size is only 800mb, everything is 120gb.

Many of the high level categories, like Web Development,contain features you'll probably never use. If you're concerned about file size you can do a custom install to get a very lean install.

That being said, I would still recommend a Windows VM be allocated a 120Gb drive.

Post reply on HN