Building static binaries of some tools using an Alpine Linux chroot with musl libc:
bsdtar
(from libarchive)mksquashfs
, unsquashfs
(from squashfs-tools)desktop-file-install
, desktop-file-validate
, update-desktop-database
(from desktop-file-utils)appstreamcli
(from AppStream)PLEASE NOTE: Do NOT add additional external dependencies or files. Everything shall be implemented in one file, runtime.c
.
PLEASE NOTE: Do NOT add a complicated "build system" (like autotools, CMake,...) other than the existing simple Makefile and bash.
Binaries are provided on GitHub Releases. Should you prefer to build locally or on GitHub Codespaces, the following will build the contents of this repository in an Alpine container:
export ARCHITECTURE=x86_64
./chroot_build.sh
This whole process takes only a few seconds on GitHub Codespaces.
make -j$(nproc) VERBOSE=1
)-o name_of_the_executable
)gcc
with gcc -static
-W...
-lpthread
./configure
can be configured like this: ./configure CFLAGS=-no-pie LDFLAGS=-static
- NOTE: LDFLAGS=-static
only works for binaries, not for libraries: it will not result in having the build system provide a static library (.a
archive)