Hi list,
I've been working on producing `-static-pie` release binaries for Bitcoin Core, using our existing Guix infrastructure. The goal is to ship release binaries that are as self-contained as possible, doing away with our few remaining runtime dependencies (libc & friends); this will also make our release binaries more portable. Currently we target any system with glibc 2.31 or later. These new binaries will be able to run on systems with much older glibcs, as well as non-glibc based systems, like Alpine (musl libc).
These changes are currently only for our x86_64 and aarch64 Linux binaries, for bitcoind, and the other utilities; bitcoin-qt and bitcoin-gui (multiprocess) won't be changing. There are plans to support more targets in future (arm32, riscv64 etc).
The binaries are built with our current Guix toolchain (GCC 14.3.0 + Binutils 2.46.0) and against glibc 2.44 (rather than 2.31), with some patching for reproducibility.
A PR with all the changes is available here:
https://github.com/bitcoin/bitcoin/pull/25573.
As of v31.1, a release bitcoind, ~18mb, looks like this:
bitcoind: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, stripped
ldd bitcoind
linux-vdso.so.1 (0x00007fffb4d49000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x0000746451893000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007464517aa000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000746450200000)
/lib64/ld-linux-x86-64.so.2 (0x00007464518a8000)
With these changes, a release bitcoind, now ~19mb, would look like:
bitcoind: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), static-pie linked, for GNU/Linux 3.2.0, stripped
ldd bitcoind
statically linked
I'm looking for any amount of testing or feedback. Please leave any questions, bugs found or concerns in the PR, or feel free to reach out directly.
You can find Guix built test binaries here:
https://github.com/fanquake/bitcoin/releases/tag/static_bitcoind_ff01e5af948dWith the following hashes:
22b757235729757bf4a225de4b34eca4d20704ad7e1fd6b48ab6902ef6fad407 guix-build-ff01e5af948d/output/aarch64-linux-gnu/bitcoin-ff01e5af948d-aarch64-linux-gnu-debug.tar.gz
1f3461c39b1776cbbaa6d216847beb6670df931121d1d4da9fbaaf6a3aad7398 guix-build-ff01e5af948d/output/aarch64-linux-gnu/bitcoin-ff01e5af948d-aarch64-linux-gnu.tar.gz
00cc2357b102dd4e1c41bf9fc0c28cc4d43ec1074b7035defc09e4c81f910322 guix-build-ff01e5af948d/output/dist-archive/bitcoin-ff01e5af948d.tar.gz
9d886b556d04658019f9882b7e10b3be26a91c5dbcdeedd4813fcaf769a7a750 guix-build-ff01e5af948d/output/x86_64-linux-gnu/bitcoin-ff01e5af948d-x86_64-linux-gnu-debug.tar.gz
5abdd153b2fc41f56c341b51c9175196f503d310dde64e109c781e8f05f019de guix-build-ff01e5af948d/output/x86_64-linux-gnu/bitcoin-ff01e5af948d-x86_64-linux-gnu.tar.gz
Thanks,
Michael / fanquake