Skip to content

Static linking #961

Description

@pflanze

The goal is to produce fully statically linked executables, including the C library; this is the only way to have a Linux binary that runs on distros with different C libraries like Alpine vs. Ubuntu.

This is necessary for #575, and blocked by #873

The C library usually chosen for this purpose is musl, which is also the C library that Alpine uses. As many people have noticed including ourselves with SILO earlier, the memory allocator in musl is very weak. Thus people generally link an alternative memory allocator at the same time. We already know that SILO suffers with the musl allocator, hence we need to do this.

The main options:

  • mimalloc (Microsoft). I have a good experience choosing this one when linking xmlhub-indexer (Rust program) with musl (it made xmlhub-indexer measurably faster when I tested it instead of glibc's allocator, before static linking). It has a known gotcha in that each thread has its own memory pool, that is only shrunk after freeing things when running some allocations from time to time (i.e. allocating lots of things, then freeing them and immediately after going to sleep in a thread leads to the space remaining reserved during that sleep time), this should be kept in mind. Otherwise works well and is quite small. Would recommend.

  • jemalloc (*BSDs)

  • tcmalloc (Google)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions