15 ms·
Actually Portable Executable
- whitten 6y agoA clever solution but still dependent on qemu.
- invokestatic 6y agoI think it only uses qemu if you attempt to execute on non-x86 architectures. So it’s not a build-time dependency.
- jessermeyer 6y agoRight. I believe the long term vision is to JIT for other architectures.
- bmn__ 6y agoPreviously: https://news.ycombinator.com/item?id=24256883 https://news.ycombinator.com/item?id=24256883 https://news.ycombinator.com/item?id=25556286 https://news.ycombinator.com/item?id=25556286
- dfgdghdf 6y agoCan someone explain the advantage over building an executable for each target system?
- sime2009 6y agoNot having to build an executable for each target system.
- mikepurvis 6y agoI 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.
- amarant 6y agoThis 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)
- rurban 6y agoNope much slower. And never worked for me.
- mikepurvis 6y agoEvery 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.
- mikepurvis 6y agoI 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.
- CydeWeys 6y agoIt 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.
- sirius87 6y agoAnd malware. I don't know why that popped into my mind as the first use-case for this and the web server. :|
- user-the-name 6y agoIt is very satisfying.
- burkaman 6y agoIt's cool.
- smallpipe 6y agoUsing completely wrong greek letters in the title is making me very uneasy for no good reason
- omnicognate 6y ago> I chose the name because I like the idea of having the freedom to write software without restrictions that transcends traditional boundaries. Actmallu pdrtable execmtable
- jwilk 6y agoSorry to ruin the joke, but y is actually in Latin script.
- omnicognate 6y agoYeah, that's why I tried to pick the closest Greek has to a y sound, which I think (I only know a bit of GCSE ancient greek from 30 years ago) is upsilon. If I'd read it as the letter that looks most like a y it would have been "actmallg" (gamma).
- jdxcode 6y agoI read your comment thinking you were being stodgy, but then I went to the site and had the same reaction.
- enriquto 6y agoI used to feel the same way, and this is indeed an annoying practice. Yet here it makes perfect sense, since this work is based on using certain symbols (e.g., header magic numbers in one executable file format) according to a non-intended interpretation based on casual and meaningless similarities (e.g., as machine instructions in another executable file format).
- madeofpalk 6y agookay well just fuck anyone using a screen reader then.
- fctorial 6y ago> One of the reasons why I love working with a lot of these old unsexy technologies, is that I want any software work I'm involved in to stand the test of time with minimal toil. Could've written a win32 program.
- est 6y agoCould it disguise as a WinRT program?
- fctorial 6y agoIt doesn't need to.
- NullPrefix 6y agoUnless it wants to pass the built in anti malware filter.
- colejohnson66 6y agoWhat’s up with your computer where Defender flags any non-RT programs? I don’t have that issue.
- nindalf 6y agoThe author is less than enthusiastic about Apple and Microsoft pivoting to ARM. Considering the perf of the M1, this is virtually inevitable. And once most developer tool chains start supporting ARM as a first class citizen, I see no reason why we wouldn’t start running our applications on ARM in the cloud. A world with 2 architectures for mainstream use cases is the future, there’s no point fighting it. (Unless you’re Intel/AMD in which case please fight it by giving us faster, more power-efficient chips for cheaper. Thanks!)
- Cthulhu_ 6y ago> A world with 2 architectures for mainstream use cases is the future And the past, I mean PowerPC was a thing for a long time on both Apple desktop systems and servers. Glad that the compiler toolchains make this transition a lot easier, and Apple has been a major contributor to that. It helped ease the transition from 32 bit ARM to 64 bit ARM, it enabled easy cross-platform apps (Mac Catalyst) and now from x86 to ARM for desktop apps. And of course it's not particularly new; 25 years ago (ish) Java came out that promised the same thing, one codebase that runs on all architectures. Scripting languages, too.
- kev009 6y agoPowerPC was also the dominant embedded platform for two decades (the rover that just landed on Mars is PPC). Point being, ARM's presence in highly vertical markets like embedded or phones means very little to desktops and servers outside of Apple.
- wbl 6y agoHow many toolchains do not have Arm64 support? Cross-compiling is ancient and most tools predate x86 being useful.
- Vvector 6y agoDoes ARM really have a performance advantage? Or is it the specific Apple customizations tailored to their use case? Apple doesn't have to worry about 35 years of legacy architecture to support.
- danmg 6y agoVery interesting, but every one of these executives I try on my fairly stock Ubuntu system returns 'run-detectors: unable to find an interpreter'. I'm invoking them with 'bash -c'.
- user-the-name 6y agohttps://news.ycombinator.com/item?id=26273058 https://news.ycombinator.com/item?id=26273058
- jart 6y agoAuthor here. That error means you're using binfmt_misc. You can fix that by saying: sudo sh -c "echo ':APE:M::MZqFpD::/bin/sh:' >/proc/sys/fs/binfmt_misc/register" Then you're good to go!
- danmg 6y agoThanks!
- mlok 6y agoClosely related : this "Show HN" of an Actually Portable Executable for a web server, published earlier today by the author : https://news.ycombinator.com/item?id=26271117 https://news.ycombinator.com/item?id=26271117
- ericol 6y agoYep, there are usually a lot of "piggybacking" (This comment is not mean spirited, just stating a fact) in HN. I made a similar comment a while back [1] https://news.ycombinator.com/item?id=25625703 https://news.ycombinator.com/item?id=25625703
- TheRealPomax 6y agoYou do know that it's the same person, right? They're both links to articles on her website. There is no "piggybacking", this is literally her writing about making these things.
- deleted 6y ago[deleted]
- md224 6y agoNo, "piggybacking" refers to the posting of related material on HN after the original material becomes popular. The posting on HN is the piggybacking, not the writing of the material itself.
- TheRealPomax 6y agoWhat? This link was submitted by someone who found the article, liked it, and posted it here in the assumption others would like it too. That's literally the entire model of how HN works, that's not "piggybacking", that's exactly what HN wants you to do for it to serve the interesting articles on the web to its user base.
- gpvos 6y agoThis got my upvote at "zip source file embedding could be a more socially conscious way of wasting resources in order to gain appeal with the non-classical software consumer".
- StavrosK 6y ago> αcτµαlly pδrταblε εxεcµταblε As a Greek, if you do this, I hate you. Why the hell do you have to make me read "actmally pdrtable execmtable"? At least this is one of the less offensive cases. EDIT: Solidarity to our Cyrillic friends!
- Tenal 6y agoDeep breaths. Deep, slow breaths. You're going to be just fine.
- deleted 6y ago[deleted]
- notretarded 6y agoFemale white privilege
- jart 6y agoAuthor here. I wanted to honor Greece for the amazing cultural impact they've had, similar to how mathematics honors Greece. We got a lot of comments like this in the last thread. What dang said about it was really smart: https://news.ycombinator.com/item?id=24264514 https://news.ycombinator.com/item?id=24264514
- JxLS-cpgbe0 6y agoWhat dang said about it was not smart. > it's good for readers to have to work a little Unless they're using assistive technologies. In that case it's a nightmare. Don't make your users work. > it's not hard for any HN reader to do the bit of work to figure it out Unless they're using assistive technologies. Or just want to read it without work. Or, say searching for it. This post comes up. The one you linked to doesn't. https://hn.algolia.com/?dateRange=all&page=0&prefix=false&query=actually%20portable%20executable&sort=byPopularity&type=story https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu... Respect to you for wanting to honor Greece. I think using the letters* correctly would honor them more. (thanks for the correction)
- m33k44 6y ago"The most compelling use case for making x86-64-linux-gnu as tiny as possible, with the availability of full emulation, is that it enables normal simple native programs to run everywhere including web browsers by default....I think we need compatibility glue that just runs programs, ignores the systems, and treats x86_64-linux-gnu as a canonical software encoding." :) Just a smiley, no other words!
- breatheoften 6y agoI think heterogeneous computing is actually coming this time. Increasing binary size requirements wherever portability is required will be an intended sacrifice toward that aim (but for app store based distributions - the only place required to pay the binary size tax will be in the size of the bundle provided to the app store vendor). I think the importance of ISAs will fade away generally in favor of specifications that enable coordination of higher level memory model semantics "across" compute resources -- the cpu/compute core becomes the thing that allows you to share reads and transfer write ownership of memory as efficiently as possible between heterogeneous components that operate on the compute graph -- and many of these compute components may require various binary forms of task specific instruction encoding ...
- timcook4253stg 6y agoHello its good
- arendtio 6y agoActually, I wonder why not every OS comes with a Posix shell and an Python interpreter nowadays. Posix shells should be super easy, because most systems have them onboard already anyways. However, since Posix shells are kinda broken, I think Python should be the next iteration. Just to give some context, I am not a Python person, as I prefer Go. But given the popularity and the suited use-cases I think it is a good option.
- perlgeek 6y agoAs somewhat of a Python developer these days, I have to point out that each 3.something release of Python potentially breaks backwards compatibility. Second issue is that Python without any extra modules is still pretty limited, nearly every serious python project comes with some extra dependencies. So have a Python interpreter available only gets you so far... (For the record, the same could be said about pretty much all dynamic languages I'm familiar with).
- toast0 6y agoMaybe a POSIX shell, as the POSIX shell standard is small and more most purposes fixed. But you don't want to use the OS python, as it is inevitably old and outdated.
- colejohnson66 6y agoThe problem is bash et al are languages designed for the command line. Every line is a separate command. Contrast: cat test.txt | grep search With:[0] import os import subprocess with open('test.txt', 'r') as f: for line in f: line = line.rstrip() subprocess.call(['/bin/grep', line, 'search']) While the first may use some “magic” symbols such as the pipe, it’s really concise in conveying what it’s doing. I will give you this: bash variables and expansions can be confusing. Contrast with programming where this probably works: "start" + variable + "end" [0]: https://stackoverflow.com/a/9018183/1350209 https://stackoverflow.com/a/9018183/1350209
- arendtio 6y agoMy problem with shells is not just about the obscure syntax, but rather about the point, that it is next to impossible to write reliable and reusable scripts. By default return codes of failed commands are silently ignored and `set -e` does not work under all circumstances. By default every variable is part of the global scope and the best you can do about it in a POSIX compliant way are sub-shells, which in turn have no way to change variables outside of their scope. It is just broken by design :-/
- deleted 6y ago[deleted]
- dang 6y agoThis is a follow-up to Show HN: Redbean – Single-file distributable web server - https://news.ycombinator.com/item?id=26271117 https://news.ycombinator.com/item?id=26271117 - Feb 2021 (141 comments) ... which is still high on the front page. Also there was a big thread last year, which is still within the dupe window: αcτµαlly pδrταblε εxεcµταblε - https://news.ycombinator.com/item?id=24256883 https://news.ycombinator.com/item?id=24256883 - Aug 2020 (286 comments) We downweight follow-ups because otherwise the front page gets too repetitive and repetition is mainly what we try to avoid here: https://hn.algolia.com/?dateRange=all&page=0&prefix=true&sort=byDate&type=comment&query=follow-up%20by%3Adang https://hn.algolia.com/?dateRange=all&page=0&prefix=true&sor... https://hn.algolia.com/?dateRange=all&page=0&prefix=false&sort=byDate&type=comment&query=curiosity%20repetition%20by:dang https://hn.algolia.com/?dateRange=all&page=0&prefix=false&so...
- greggturkington 6y agoThere is no way to find the other thread using the site search though
- TheRealPomax 6y agothe what now?
- latexr 6y agoThere’s a search bar right at the bottom of HN pages.
- TheRealPomax 6y ago... there's content at the bottom? O_o
- kazinator 6y agoI don't understand how this provides a POSIX API on Windows. There is a tcsetattr function in Cosmopolitan. If I use that to obtain character-a-a-time input with no echo, and then run the portable executable Windows, will that have the right effect in the console window?
- jart 6y agoYup. See https://justine.lol/blinkenlights/blinkenlights-windows.png https://justine.lol/blinkenlights/blinkenlights-windows.png and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d71d17256684118e1b1cd03/libc/calls/ioctl-tcsets-nt.c#L29-L65 https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d71d17256684118e1b1cd03/libc/calls/ioctl-tcsets.c#L41-L48 https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d71d17256684118e1b1cd03/libc/calls/tcsetattr.c#L35-L46 https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... and https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d71d17256684118e1b1cd03/libc/runtime/winmain.greg.c#L86-L113 https://github.com/jart/cosmopolitan/blob/fcfe7c108083962a3d... It's not perfect though. For example, right now Cosmopolitan won't do the really dirty hacks that Cygwin does to fully simulate POSIX like creating a virtual filesystem or spawning daemons and threads for handling signals. Cosmopolitan does however give you 90% the value at 10% the price. This has been great for my use case, since I'm mostly only concerned with greenfield development. I wanted the feel of POSIX but I didn't need to check off a box with a regulatory body that it conforms perfectly to POSIX. I'm also not trying to create a distro that leverages all the open source works written to date; Cygwin and MinGW are already doing a great job at that and I view Cosmopolitan as complementary.
- kazinator 6y agoI needed a way to port program to Windows with accurate POSIX, like Cygwin, but without the Cygwin paths and virtual file system and other user-visible quirks. In under twenty or so fairly simple commits to a fork of the Cygwin DLL, I got it: http://www.kylheku.com/cygnal/ http://www.kylheku.com/cygnal/ This is another useful tool in this general arsenal.