← Back to context

Comment by dfgdghdf

5 years ago

Can someone explain the advantage over building an executable for each target system?

Not having to build an executable for each target system.

  • I think it’s neat how this acknowledges the reality that the actual meat of the machine code is identical for every x86_64 target— all that's different is the OS interface. So unlike other "fat binary" schemes where there's a lot of duplication, this one has a single main program and then small shims to provide the Linux ABI on MacOS and Windows.

I don't think it has any benefit if you're installing software exclusively that you built yourself on your own targets, or from a distro package manager. But it's potentially a boon for a whole class of statically-linked rescue tools, installers, command-line utilities — basically anything where there's a website with a curl path/to/thing > local/bin/thing installation option.

  • It also makes manually downloaded software distribution easier. Rather than the user having to select which version of the software to download (which users often get wrong), or trying to guess based on browser user-agent, there's just the one download link that works on everything.

  • And malware. I don't know why that popped into my mind as the first use-case for this and the web server. :|

This is slightly faster I guess?

I don't think it's that big of a deal either, since compiling these days is fast enough you can do it 3 times without it being a problem.

Don't get me wrong, it's very impressive, I just don't think it makes that big of a difference in practice, especially since environmental differences will still require you to have 2 codebases in many scenarios (like accessing the filesystem for example)

  • Every source-portable program has that anyway though, typically either with a bunch of ifdefs, or by linking to an abstraction like boost::filesystem.

    The change here would basically be that all versions of it would have to be compiled into the same binary, with a runtime switch.