6 ms·
Technically the executable only runs on 6 operating systems as the 7th option basically turns the application into an operating system running on bare metal. J
by jeroenhd 4y ago
Technically the executable only runs on 6 operating systems as the 7th option basically turns the application into an operating system running on bare metal.
Justine's impressive work on this subject makes me wonder if it's possible to build truly native applications using more complete toolsets and more modern languages. Multiplatform toy programs have existed for ages, but this SDK of sorts makes it possible to write executables that don't require manually tricking the compiler or adjusting your code for portability with inline assembly. As long as the program is statically compiled and contains the necessary drivers for things like syscalls, this should be perfectly possible, though the current implementation isn't exactly user friendly, relying on giant headers like https://justine.lol/cosmopolitan/cosmopolitan.h https://justine.lol/cosmopolitan/cosmopolitan.h, statically linked components like https://justine.lol/cosmopolitan/crt.o https://justine.lol/cosmopolitan/crt.o and https://justine.lol/cosmopolitan/ape.o https://justine.lol/cosmopolitan/ape.o, and other such tweaks.
I'd love a Go/Rust compile target that just works regardless of operating system. As an added bonus, the bare metal nature would be excellent for platforms like Firecracker to run services without even needing to boot a kernel!
- ElectricalUnion 4y agoA target like Rust x86_64-linux-unknown-cosmo ? https://news.ycombinator.com/item?id=32260619 https://news.ycombinator.com/item?id=32260619 https://ahgamut.github.io/2022/07/27/ape-rust-example/ https://ahgamut.github.io/2022/07/27/ape-rust-example/
- jeroenhd 4y agoThis is great, I must've missed it! Thanks for the link!
- jart 4y agoThere's so much great stuff going on in the cosmoverse that it's hard to keep track of it all! We recently started https://github.com/shmup/awesome-cosmopolitan https://github.com/shmup/awesome-cosmopolitan for that reason.
- gwbas1c 4y agoKeep in mind that, although this is a cool concept; in practice everything needs an installer. (IE, a .msi file or a Setup.exe for Windows, a .dmg or a .pkg for Mac, and whatever Linux requires.) And, if you're shipping into an app store, there's really no point in using something like this.
- MobiusHorizons 4y agoWhy does it need an installer if it doesn’t contain dll’s or assets? Is that a technical requirement, or are you saying end users want an installer.
- solidsnack9000 4y agoOne practical reason is managing the lifecycle -- upgrading the app, removing the app.
- akaij 4y agoNot sure why this can't be accomplished by simply replacing or removing the executable?
- dataflow 4y agoIt's a bit like asking "Why do you need a phone book to store someone's number? Can't you just call people directly?"
- zasdffaa 4y agoThe comparison is fatuous. If your mates had names and there was a button on your phone, one for each acquaintance by name, you wouldn't need a way of looking them up. BTW I also worked on a small in-house system that was just a run-it-from-the-desktop install (aka xcopy install) and it worked perfectly. Boss insisted we needed a "proper" installer so I tried the installer-maker provided by MS. Jesus what a fucked-up mess that made of the whole process, a day of trying to get that working (while it sprayed guids and subdirectories everywhere and could't even uninstall what it installed) and I gave up. I also have a fun story of an MSSQL uninstall that went wrong on a live server. executive summary is that xcopy installs work very well IME.
- G4Vi 4y agoIt would be nice if you didn't need to start out with tons of ccflags and ldflags, but I'll point out you don't actually need to use the amalgamation header, alternatively using -isystem you can pass the libc/isystem directory to add the libc headers to the include path. Especially for porting existing projects, I recommend against using the amalgamation as sometimes including everything all the time causes problems.
- behnamoh 4y agoI would even argue that it runs on 3 (or 4 if I'm generous). From the website: > Linux, Mac, Windows, FreeBSD, OpenBSD, NetBSD, and BIOS 1. Windows 2. Linux 3. Mac (which is a descendent of BSD, though with different kernel.) 4. BSD (including FreeBSD, OpenBSD, NetBSD) The "OS" in BIOS doesn't stand for Operating System! It's Basic Input/Output System.
- smm11 4y agoI read 7 and just knew it would list every BSD instance possible except OS X, then GNU would just HAVE to be there.
- laumars 4y agomacOS (it’s not called OS X any more) is listed as XNU. And of course it would list every BSD instance. Supporting them isn’t automatic when you’re taking about pre-compiles binaries because they can have subtly different ABIs. POSIX helps here but mostly at the source level, an ELF compiled for FreeBSD wouldn’t automatically run on OpenBSD nor NetBSD. The fact this does is unusual and deserves calling out.
- scns 4y ago> list every BSD instance possible Sorry to be a pedant, but DragonflyBSD is missing.
- kelnos 4y agoCan you build a binary on NetBSD with gcc or whatever, linked to the system libc (or whatever usually happens by default), such that you can copy it over to a FreeBSD or OpenBSD system and it'll just run, without having to install any kind of special compat or emulation layer? If so, ok, sure, then you have a point. Otherwise, no, those are three distinct OSes, and it's entirely correct to list them as such. I know you can't mix macOS into that, so the "or 4 if I'm generous" is pretty unfair. > The "OS" in BIOS doesn't stand for Operating System! It's Basic Input/Output System. I don't think the author is claiming it means "Operating System", just that "BIOS" is a simple shorthand for "bare metal". Which no, isn't an "operating system" in the classical sense, but it is a standardized set of very low-level system services that sorta vaguely kinda acts like one. And if we consider UEFI rather than old-school PC-BIOS, it's even more like an OS. Your comment just feels like pedantry for pedantry's sake (and not particularly correct pedantry, at that). Not sure what you're trying to accomplish here by minimizing the achievement.