Top
Best
New

Posted by pbohun 3/29/2025

Convert Linux to Windows(philipbohun.com)
371 points | 452 commentspage 4
nunobrito 3/30/2025|
He is not wrong. My software compiled with Borland Delphi 1.0 works beautifully with Wine under Linux and works just good as well under Windows.

I'm saying this as Java developer. Delphi eventually proved itself to be the true "compile once, run everywhere". Can imagine others who wrote executables for Windows before the .NET times can relate to similar experiences.

a3w 3/30/2025||
> I can pull down a 20 year old exe and still run it today on Windows

Barely - most bigger programs did not adhere to all standards, but got custom fixes under the hood in follow-up windows versions.

Also, around 2001 was the big architectural change for desktop from DOS to NT, so this might seem like cherry-picking the timeframe selected.

Gormo 3/31/2025|
> Also, around 2001 was the big architectural change for desktop from DOS to NT, so this might seem like cherry-picking the timeframe selected.

It's true that the entire Windows product family converged onto the NT codebase with the release of Windows XP, but this isn't really relevant -- Windows executables and DOS executables were always different things, and despite being built on top of a DOS-based kernel, Windows 9x still supported the same Win32 binaries that ran under NT.

There was even an extension called Win32S that allowed Win32 executables to be run under Windows 3.1. The Win32 API dates to the early '90s, and modern implementations do support executables dating all the way back to the beginning.

nurettin 3/30/2025||
> Try doing the same with a Linux binary that's just a year old.

I do that all the time. Just link to a static glibc or musl.

amavect 3/30/2025||
I really want to statically link OpenGL and Vulkan for exactly this purpose, but neither use a wire protocol (unlike X11 or Wayland). The whole "loading library" scheme feels like hazing for any beginner graphics programmer on top of the already complex graphics APIs.
DrFalkyn 3/30/2025||
I know at least for OpenGL, not all graphics cards/drivers would implement the entire featureset. So there was a reasonable justification for the dynamic linking and bringing in functions one by one.
amavect 3/30/2025||
I think that a wire protocol could support that with a query response for supported versions and functions. The decision of dynamic linking removes the overhead of serialization, but removes the option of static linking.
panzi 3/30/2025||
Yeah, just my thought. Instead of all the effort and overhead and awful API of Win32 just statically link musl. Still, there are of course downsides and limitations to either approach.
alphazard 3/30/2025||
> While the Linux syscalls themselves are very stable and reliable, the c library on top of them is not.

Maybe just don't use that library then? Or don't do that ridiculous thing where you fumble around at runtime desperately looking for executable pages that should just be included in your binary.

squiggleblaz 3/30/2025|
It's not "some c library on top of them", it's glibc. You can use another libc, but that means you're going to be incompatible with the distro expectations in terms of configuration, because that's handled by glibc, so you just push off the instability to a different part of your system.
graemep 3/30/2025||
There are multiple distros that make it very easy - as in download a .exe or .msi and click on it: https://help.zorin.com/docs/apps-games/windows-app-support/

Some of these have a long history: https://en.wikipedia.org/wiki/Linspire

They have never been all that successful.

I suspect there is not enough overlap between people who want to use Linux and people who need to run Windows apps that badly for it to be viable.

The biggest problem is games, and even with Steam's best efforts not all Windows games will run on Linux, AFAIK.

xtracto 3/30/2025||
I want the opposite: id like a way to run the windows kernel, drivers and most low level OS stuff by windows, but with a Linux user Interface: Cinammon, apt and all the debian stuff.

I run Mint as my main OS, but hardware compatibility is still a headache in Linux for me.

p_ing 3/30/2025||
You can resurrect SFU and build a replacement GUI for Explorer. You can't get rid of Win32, but you can cover up most of it. Implementing a Personality would be the Windows-way of doing this as it is designed for just what you ask.
trelane 3/30/2025|||
If you're not buying a laptop with Linux preinstalled and supported by the hardware vendor, you're going to have a hard time.

You might get lucky, but it sounds like you've not been lucky.

tombert 3/30/2025||
I’ve never bought one of the dedicated Linux laptops, but I’ve had pretty good luck with AMD stuff.

My current laptop, Thinkpad P16s AMD Gen 2, was pretty straightforward to get working with NixOS. No special drivers, and everything, including WiFi and function buttons on the keyboard, worked fine without any kind of special concessions.

This was also the case for my last non-Mac, from 2017-2020, I got Ubuntu installed on there without many headaches, and it wasn’t a specific Linux laptop, though again it was AMD.

throwaway48476 3/30/2025|||
What hardware isn't compatible?
DeathArrow 3/30/2025||
Doesn't WSL do that?
magicalhippo 3/30/2025||
WSL 1 did, WSL 2 runs in a VM.
DeathArrow 3/30/2025||
This is a wonderful idea. I have some doubts, though. It might not provide a seamless experience.

Just transforming Windows syscalls into Linux syscalls is not enough. There should be some form of emulation involved.

Many apps, like games are using hardware, that means some additional layers of emulation.

>Imagine we made a new Linux distro. This distro would provide a desktop environment that looks close enough to Windows that a Windows user could use it without training. You could install and run Windows applications exactly as you do on Windows; no extra work needed.

I a rough user experience, some loss of performance and many bugs.

But I hope I am wrong, because the idea sounds really promising.

James_K 3/30/2025||
Java already solved this problem, for the most part. This whole ABI nonsense really grinds my gears. It's essentially just a result of the silly decision to compile software into dubious blobs and ship those to users. You could get rid of an awful lot of malware and massively simplify software distribution if you were to distribute a platform agnostic intermediary representation of source code that preserves enough semantic meaning to eliminate ABI issues, then leaves the last step of compilation to the operating system. Shipping binary files is just plain bad in every way.
wyldfire 3/30/2025||
> Shipping binary files is just plain bad in every way.

Aren't .class and .jar files "binaries"?

> Java already solved this problem, for the most part

Maybe, just maybe, there are some drawbacks that mean that in fact it's not solved. Otherwise perhaps Java would've completely obsoleted C, C++. Some of us design applications which can't tolerate the worst case GC pauses, for example. Some of us design applications which we can't afford to spend extra time heap-allocating nearly everything.

xxs 3/30/2025|||
>Aren't .class and .jar files "binaries"?

Not at all. jar is just a zip with a different extension +some metadata in META-INF (including dependencies). class are compiled java files but they do contain all kinds of metadata, including variable names and debug info (if you choose to retain it). they contain all methods and fields with their original names (along with annotations), so the reflection APIs work. Decompiling a class file is trivial to a point the original line numbers can be restored.

>Otherwise perhaps Java would've completely obsoleted C

Java does require a managed runtime written mostly in C/C++.

>Some of us design applications which can't tolerate the worst case GC pauses

The current breed or low latency GCs w/o a stop-the-world phase should suffices for a large set of applications.

>we can't afford to spend extra time heap-allocating nearly everything.

That has not been an issue for quite some time, heap allocation can be elided, and under normal condition is just a pointer bump. Per thread private allocation is by far the most common case - the garbage collection of non old-gen referenced objects is totally trivial too (i.e. memset). Even shared (cross thread/area) allocation is a CAS'd bump in most cases. Note: copy/generational garbage collectors copy objects that are referenced by non-young-gen ones to another area, then zero the original area.

With that being said - Java (and managed languages) are no panacea.

3036e4 3/30/2025||
Java can be optimized beyond all recognition, into bytecode that can no longer be represented by the Java language. At least that used to be the case in the past. It is not different from other binaries, except the target system is a virtual CPU rather than a real one.

Java also deprecated all sorts of things over the years. Not to mention applets being completely killed off. I have Java binaries from 25 years ago that could no longer run at all with a contemporary run-time already 10-15 years ago.

Not to mention much of real-world Java is platform-specific. Not often native code perhaps, but more subtle things like hardcoded paths or forgetting to properly use the correct path-separator. Installers used to often be platform-specific as well. Maybe that has been solved, but you would still run into trouble trying to install an old Java application that has an installer only supporting contemporary Windows and Mac systems.

xxs 3/30/2025||
> Java can be =optimized= beyond all recognition, into bytecode that can no longer be represented by the Java language.

I am not sure how that works, Java is all about JIT. Bytecode almost doesn't matter. Personally I can read assembly (and years [decades] back could just read hex). So even obfuscated (not optimizied) Java is quite readable. Still, the class files do retain all method declarations, all constant pool entries and all bytecode (again trivial to decompile). There have been few changes in the class format of course.

> Java binaries from 25 years ago that could no longer run at all with a contemporary run-time already 10-15 years ago.

Need a shorter frame, Java 8 (10y back) could run pretty much anything from java 1.0 (or even 0.9). It's quite more recent - Java 9 (2017) that introduced project jigsaw. Prior that Java was by far the most backward compatible platform. Still is, for most applications. Do note deprecation mean(t) - do not use in new projects, not it has been removed; again those are more recent changes.

>Not to mention much of real-world Java is platform-specific.

Again, that's super rare nowadays. Stuff like zstd might load a library but even then the native code interfaces are the same across pretty much all platforms. If you talk about native UIs you might have some point, of course.

>to properly use the correct path-separator.

Windows with its backslash is notorious, yet - there is no reason to use backslash any longer, for like 25years now. All Windows paths do work with forward slash (aside that the separator is readily available in java.io.File)

James_K 3/30/2025|||
> Some of us design applications which can't tolerate the worst case GC pauses, for example

First of all, I should like to point out that such people are overwhelmingly deluded and come to this belief without ever actually having tested the hypothesis. But at any rate, the idea of a JAR file doesn't require garbage collection. We can already see this with things such as Wasm, though it doesn't quite achieve what I would want.

mqus 3/30/2025|||
You mean ABI issues like not being able to run a java 11 jar on a java 8 runtime?
James_K 3/30/2025||
No, I mean ABI issues like not being able to change the order of fields in a struct.
robocat 3/30/2025|||
> dubious blobs

I think you are just suggesting to replace binary blobs with other binary blobs e.g. CLR/.NET assemblies/executables or WebAssembly files.

Or do it the JavaScript way: distribute compressed minified (kinda compiled) source code and the runtime JIT compiles it at runtime (e.g. V8 engine Turbofan compiler).

James_K 3/30/2025||
I'm trying to replace platform dependant and easily breakable binary files with platform independent and change resistant files. Yes, those files are still in binary, but this is true of all files on a computer. What's useful about these new formats is that they retain a greater degree of information about the source code.
nice_byte 3/30/2025|||
java classes have "abi". any binary representation of executable code that is supposed to be interacted with by other code necessarily defines an application BINARY interface.
xxs 3/30/2025||
The point was that the "abi" is platform independent (and has very late bindings)
DeathArrow 3/30/2025|||
Why Libre Office takes much more time to start than MS Office? Why does it feel sluggish?

At least you didn't propose to write everything in Javascript.

James_K 3/30/2025||
While the Java implementation is suboptimal, there is really no need for it to be that way. I think the ideal way to go about it would be to run the compiler optimisations and whatnot then generate something semantically similar to C89 as output. Then you invoke a simple compiler with few optimisations on the target machine the first time the program is run, and cache the results somewhere. On all subsequent runs, you've got something which can actually run faster than pre-compiled C code because the compiler doesn't need to preserve the ABI so can do stuff like inlining dynamic library calls.
DeathArrow 3/30/2025||
Do you know any software that does that?
James_K 3/30/2025||
Sadly not. Wasm is attempting something similar, but it lacks certain things that would be important for this (the to specify in one module a type of unknown size and then query its size in another module at link time).
6483974564 3/30/2025||
[flagged]
quotemstr 3/30/2025||
> In Windows, you do not make system calls directly. Instead, you dynamically link to libraries that make the system calls for you. This allows Microsoft to do all sorts of shenanigans at the kernal level while providing a stable API to userspace. This little stroke of genius allows us to have both Linux and Windows on the same machine at the same time.

Precisely correct. Linux should never have allowed system calls from outside libc or a big vdso.

DeathArrow 3/30/2025|
I wouldn't be surprised if Microsoft does something to that effect in the future. Have Win 32 as a layer on top of Linux.

They seem to not be interested in locking the hardware and they don't make much money from selling Windows and it shows. There aren't many strong improvements in Windows and it feels like Windows is a platform they use to sell other stuff they make money with - they are with Windows in a similar position Google is with Android.

More comments...