Statically linked build of 0install

"Bastian Eicher" <[email protected]> Sun, 28 Oct 2018 14:15:35 +0100
Newsgroups gmane.comp.file-systems.zero-install.devel
Message-ID <[email protected]>
Hi all,

I've recently been experimenting with running 0install in Docker containers
based on various Linux distributions. Since I wanted to use the latest
version I downloaded the pre-built binaries listed here:
http://0install.net/tools/0install.xml

On Debian Stable and Ubuntu 18.04 I simply had to run "apt-get install
libcurl3", download and extract the 0install archive and was good to go.
However, on Debian Testing and Ubuntu 18.10 libcurl3 has been replaced with
libcurl4. After installing this 0install fails to launch with:
"/lib/x86_64-linux-gnu/libcurl.so.4: version `CURL_OPENSSL_3' not found"
Installing a libcurl3 package intended for an older distro also isn't a good
option, since libcurl3 and libcurl4 both attempt to install the same file
and therefore cannot co-exist on the same system. Forcibly downgrading
libcurl also breaks the curl command on the system.
Running the binaries on Alpine is of course even trickier, since that distro
does not use glibc.

This got me thinking: Would it be practical to create completely statically
linked builds of 0install? A quick Google search turned up a blog article
titled "Creating Static Linux Binaries in OCaml"
(http://rgrinberg.com/posts/static-binaries-tutorial/). Since I have no
experience with OCaml yet, I'm not sure if this is applicable to 0install.
@Thomas: Could you perhaps take a quick look?

It is somewhat common for Linux users to build applications from source if
they want a version newer than the one provided by their package manager.
However, I feel that a tool such as 0install, aiming at simplifying
acquiring software, should itself be as easy as possible to acquire. I
believe the interest in Linux binaries with zero runtime dependencies is
also demonstrated by popular statically linked Go binaries such as docker,
kubectl and terraform.

Regards
Bastian