What does HackerNews think of blink?

tiniest x86-64-linux emulator

Language: C

> Consider offering APE for x64 but then still producing ARM binaries the old fashioned way.

The recent version of cosmopolitan generates ARM binaries for Linux and MacOS (https://github.com/jart/cosmopolitan#arm; mode aarch64). There is also blink that provides the x86-64 emulation layer for (APE and other) binaries on a variety of platforms (https://github.com/jart/blink).

I've never used it, but https://github.com/jart/blink is pretty much that. It's tiny and:

> We regularly test that Blink is able run x86-64-linux binaries on the following platforms:

> Linux (x86, ARM, RISC-V, MIPS, PowerPC, s390x)

> macOS (x86, ARM)

> FreeBSD

> OpenBSD

> Cygwin

From what I gather, it's in the "excellent but incomplete" stage. It's new enough.

This is some of the slickest web design I've seen in a long time. Have you seen https://github.com/jart/blink this?
djngo.com is the culmination of years of effort, creating a single file python executable that runs on all platforms. This project is based on APE (https://justine.lol/ape.html) and in the past few days, our Python APE port (called python.com) became good enough to run Django. So we put Django inside the executable too, and called it djngo.com. The djngo.com executable will just work on the following platforms:

- Apple x86_64 and ARM64

- Linux running x86_64 or ARM64 (Raspberry Pi)

- Windows running x86_64 and possibly ARM64 too

- FreeBSD, NetBSD, and OpenBSD running x86_64

It does not require that Python be installed beforehand. It's a native Python executable. It does not require Rosetta or Qemu be installed either, in order to run ARM64 platforms. It does not require Cygwin or MSYS2 runtimes in order to run on WIN32. It only depends on KERNEL32. It has an embedded JIT VM called Blink (https://github.com/jart/blink) which it pulls out on non-x86 platforms to emulate itself. All its dependencies are bundled inside using a zip polyglot, including the Python standard library:

    unzip -vl djngo.com
    ...
    5588  Defl:N     1707  70% 02-23-2023 16:06 26fb04f6  .python/django/shortcuts.py
       0  Stored        0   0% 02-23-2023 16:05 00000000  .python/ctypes/
      34  Stored       34   0% 02-23-2023 16:05 1b5bb9b2  .python/ctypes/__init__.py
    --------          -------  ---                            -------
    35075517         11728493  67%                            7171 files
You can put your app's assets inside the djngo.com file too, using the standard zip tool. You can then rename the file, and insert a `.args` file that supplies default args for launching your white-labeled app.

This means that if you're a Django app developer, you can now easily share your apps with others wanting to run it locally. It's almost as easy for anyone on any platform to use, as if you productionized it onto a website. Rather than a hyperlink away, it's a single file download and CLI invocation away. You won't need to explain things like, "here's how you install Python on Windows" or "here's how you install Docker and setup a Linux distro, in order to run my app." Your users will be in full control of the app, granting maximum privacy and control over data, and zero operations toil for you!

Note that this is not Blink the rendering engine that powers Chromium and related browsers, but https://github.com/jart/blink, “a virtual machine that runs x86-64-linux programs on different operating systems and hardware architectures”.

Where this talks of running GUI programs, I presume it means that the VM can act as an X client. You would thus still need an X server. I don’t know what may exist along those lines for the web. As for native/desktop hosts, well, I hope you weren’t ever trying to use emulation as any form of security, because the likes of Xorg really aren’t designed for that use case.