Recommand `curl | bash` as default installation is not ideal?

Not cross-platform packaging system no, but cross-platform binaries yes.

And I’ve proposed such APE for juliaup before, others agree with me (italics in original):

Catching up with the Cosmopolitan ecosystem

I caught up with some of the latest developments in the ecosystem around Justine Tunney’s cosmopolitan and Actually Portable Executable (APE) projects this week. They are absolutely fascinating.

An Actually Portable Executable is a wildly clever hack. It’s a single binary file which can run as an executable on multiple platforms - on x86-64 Linux, macOS, Windows and various BSDs, and for ARM-64 on Linux and macOS too (macOS ARM-64 is a recent addition).

https://justine.lol/ftrace/python.com is a downloadable executable of Python 3.6 that worked on my Mac:

$ ./python.com   
Python 3.6.14+ (Actually Portable Python) [GCC 9.2.0] on cosmo
Type "help", "copyright", "credits" or "license" for more information.

The same file worked on my Linux too, well you first need to do:

chmod u+x ./python.com

which is a good thing (and I suppose on macOS too; but not on Windows I believe, nor anything similar, unless in WSL).

lang.zip
contains languages berry, janet, lua, php, and Python 3.12.

Could contain Julia, or well juliaup, likely better.

The superconfigure build is the single executable I was referring to – I add the packages/app I need into the CPython source tree.

… contains a single-file python executable that can run the datasette app.

So the datasette binary from superconfigure is a single-file python executable, that works across (Linux/MacOS/BSDs/Windows on x86_64 and Linux/MacOS on aarch64), and I can add pure-python libraries to my executable using pip and the zip command when I need to. This covers my use cases for now. C extensions can be done as well

It seems like an interesting project, see also its subproject: llm.datasette.io

It can be used with Rust, at least currently with some limitations (no longer any?):

2023-11-01 Update: I found out that Rust decides system constants like EINVAL and SIGTERM at compile-time, which means that the portability of Rust executables is limited to x86_64-linux and aarch64-linux, the targets with which the executables are built. It’s good to know that Cosmo can be a viable target for Rust …

I just built a Rust executable with Cosmopolitan Libc. If you’d like to build it yourself, clone this repo and follow the README – you’ll need a recent gcc, ld.bfd, objcopy, bash, and the latest (nightly) versions of cargo, rustc, and friends.

… Here’s how I got to a hello world! with Rust.

A minimal executable

A good thing about Rust was, unlike Python or Lua, no messing around with C headers. Just find a way to tell cargo to link with cosmopolitan.a at the very end, and you get an APE.

1 Like