6 ms·
Tiniest x86-64-Linux emulator
- psychphysic 4y agoBiggest thing for me here is I didn't realise qemu-x86_64 was only 10mb!
- xmonkee 4y agoman, jart's projects make me feel that 1/10x engineer
- ngcc_hk 4y agoOr 1/100. Crazy. But as said not sure I aware qemu is so small. Thanks.
- ronsor 4y agothe only person that can compete with Fabrice Bellard
- mhh__ 4y agoFabrice is on a higher level (mainly by virtue of being older, possibly more numerate)
- intelVISA 4y agoit's not for us mortals to judge the Gods
- userbinator 4y agoDefinitely more numerate. https://en.wikipedia.org/wiki/Bellard%27s_formula https://en.wikipedia.org/wiki/Bellard%27s_formula
- anthk 4y agoAnd "lower", too. He even created DVB-T signals from the monitor refresh frequency by tuning X11's specs.
- LoganDark 4y agoThe projects of even a normal dev make me feel 1/10x sometimes. Was told I might need ADHD meds to be productive. I haven't gotten to try any yet.
- yjftsjthsd-h 4y agoThat's beautifully worked. o//blink/blink What's the double slash for?
- paulclinger 4y agoYou can use it to configure the build mode: `build/bootstrap/make.com -j8 MODE=rel o/rel/blink/blink`; no MODE will build a default config. This is used across all cosmopolitan projects; for example, this is for redbean: https://redbean.dev/#source https://redbean.dev/#source.
- yjftsjthsd-h 4y agoI'm not following. Is o//blink/blink different from o/blink/blink ?
- mdhowle 4y agoThe MODE variable in the Makefile is undefined by default so "o/$(MODE)/" becomes "o//"
- harrisi 4y agoThere are specific comments already, but multiple successive slashes are treated as a single slash, in every case except when a path begins with exactly two slashes, in which case it's implementation dependent. https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271 https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1...
- wilburm 4y ago
- molticrystal 4y agoThey also made cosmopolitan libc [0] which outputs a single binary that runs on many platforms. > The above command fixes GCC so it outputs portable binaries that will run on every Linux distro in addition to Mac OS X, Windows NT, FreeBSD, OpenBSD, and NetBSD too. Your program will also boot on bare metal too. In other words, you've written a normal textbook C program, and thanks to Cosmopolitan's low-level linker magic, you've effectively created your own operating system which happens to run on all the existing ones as well. Brought up recently here: "Debugging C with Cosmopolitan Libc" [1] And introduced here "Cosmopolitan Libc: build-once run-anywhere C library" [2] [0] https://justine.lol/cosmopolitan/index.html https://justine.lol/cosmopolitan/index.html [1] https://news.ycombinator.com/item?id=33312012 https://news.ycombinator.com/item?id=33312012 [2] https://news.ycombinator.com/item?id=25556286 https://news.ycombinator.com/item?id=25556286
- deleted 4y ago[deleted]
- geokon 4y agoCan you build cross platform libs? So like say you have python or java that calls out to some native code (ex: high performance math routines), but that native code is actually "cosmopolitan"/crossplatform?
- grishka 4y agoWhy not? The difference between an executable and a dynamic library is that an executable has one entry point but a dynamic library can have more than one.
- comex 4y ago> It'll be nice to know that any normal PC program we write will "just work" on Raspberry Pi and Apple ARM. All we have to do embed an ARM build of the emulator above within our x86 executables, and have them morph and re-exec appropriately, similar to how Cosmopolitan is already doing doing with qemu-x86_64, except that this wouldn't need to be installed beforehand. The tradeoff is that, if we do this, binaries will only be 10x smaller than Go's Hello World, instead of 100x smaller. …No mention of the fact that an interpreter is typically at least 10x slower than native execution. The readme does say "we're still likely to add something like jit in the near future", but for now this isn't very practical.
- FullyFunctional 4y agoPresumably apps which spend most of their time in system calls will not be noticeable slower.
- deleted 4y ago[deleted]
- alophawen 4y agoPetty remark, comex. Their pitch is "tiniest".
- codedokode 4y agoThis project is interesting, but I looked at tests folder and there is not many tests despite software is so complex. Also I wonder, isn't it better to write tests in languages like Python? Also, I don't see what's the use of Cosmopolitan Libc. In what situation does one need a CLI-only binary that can run on any system?
- cylinder714 4y agoHaving a copy of Perl, for example (https://computoid.com/APPerl/ https://computoid.com/APPerl/), on a USB stick means one could run scripts using the same version of Perl across multiple platforms, no need to wrestle with outdated instances. Also, it's an awesome hack! C'mon, man, this is Hacker News!
- jart 4y agoAuthor here. Right now it's being tested by running precompiled binaries. See https://github.com/jart/blink/tree/master/third_party/cosmo https://github.com/jart/blink/tree/master/third_party/cosmo Most of these test binaries are sourced from the cosmopolitan repository, and many of those come from other projects like nsync, mbedtls, etc. I've recently started working on a unit testing method that's written in plain assembly, to hopefully catch more of the things that would show up in opcodes that compilers don't generate. See https://github.com/jart/blink/tree/master/test/asm https://github.com/jart/blink/tree/master/test/asm