-
Notifications
You must be signed in to change notification settings - Fork 38.6k
guix: produce a -static-pie bitcoind
#25573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/25573. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
da9f731 to
26c437e
Compare
|
Rebased, and made small changes to fixup the linter and improve the security/symbol checks. |
|
This is amazing!
Hard agree. Static musl builds would be very cool but tricky to audit for parity and thus pretty unlikely to ever become official/supported imo. This is a MUCH more palatable change. |
26c437e to
8cccf45
Compare
|
Added an additional patch to disable building various features/libs in GCC that we don't need. i.e libquadmath, libsanitizer, gcov, libada and native language support. This should speed up compiling GCC, and slightly reduces the size of the pthread patch. I'm not currently disabling these features via the available configure flags, because they get passed through to GMP, which cannot handle them. I've also updated lto-wrapper: warning: using serial compilation of 84 LTRANS jobs
lto-wrapper: note: see the '-flto' option documentation for more informationI've also split the ELF PIE check into it's own func, so we can special-case x86_64, and re-added the list of allowed ELF libs, but special-cased x86_64 to only pass if the list is empty. |
|
How does this handle resolvers? eg, static glibc 2.33 applications break on systems with glibc 2.34... |
8cccf45 to
caa0664
Compare
|
Which OS did you build on? On Ubuntu 20.04 after build: Trying to run it, it crashes after seconds: Any ideas? |
The base OS shouldn't matter, because the build is performed with Guix. However I've been performing these builds on Ubuntu 22.04.
How did you actually build bitcoind? Something like |
caa0664 to
ef0edd5
Compare
|
Rebased on master. Added a commit to use LIEF master, which reduces the number of changes in our scripts, as support for |
Yes, that's what I used to build it. |
I have just re-tested building the changes here (ef0edd55f3bc1e3f229134ec7ecac632de52eea7), and this produces a guix-build-ef0edd55f3bc/distsrc-ef0edd55f3bc-x86_64-linux-gnu/src/bitcoind: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), static-pie linked, for GNU/Linux 3.2.0, with debug_info, not strippedIt's not clear to me that you are actually running a Guix build. |
|
the build I was testing: just building again, fresh cloned with commit ef0edd5 $ file guix-build-ef0edd55f3bc/distsrc-ef0edd55f3bc-x86_64-linux-gnu/src/bitcoind $ ldd ./guix-build-ef0edd55f3bc/distsrc-ef0edd55f3bc-x86_64-linux-gnu/src/bitcoind $ ./bitcoind build and run on Ubuntu 20.04 |
|
building the same on Ubuntu 22.04: ldd guix-build-ef0edd55f3bc/distsrc-ef0edd55f3bc-x86_64-linux-gnu/src/bitcoind Running it on Ubuntu22 it works. Taking this bitcoind to Ubuntu 20 it shows: and crashes with the above mentioned message: Checksums are the same for both builds (on Ubuntu 20 and 22) Same bitcoind on Debian 10: |
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
Essentially picked (into bench-ci/guix) from bitcoin#25573 Co-authored-by: fanquake <[email protected]>
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
Prunes: libgomp.a libgomp.la libgomp.so libgomp.so.1 libgomp.so.1.0.0 libgomp.spec
Prunes: libquadmath.a libquadmath.la libquadmath.so libquadmath.so.0 libquadmath.so.0.0.0
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
-static-pie bins will not have any imported functions.
-static-pie Produce a static position independent executable on targets that support it. A static position independent executable is similar to a static executable, but can be loaded at any address without a dynamic linker. See https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
6b2e397 to
da33b9d
Compare
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
This will eventually be needed for bitcoin#25573, and could be useful for bitcoin#30210.
2a74650 ci: migrate some jobs to Debian Trixie, use GCC 14 (fanquake) fb0e6ed guix: Apply SSA generation patch to maintain determinism (Mara van der Laan) 3490979 guix: use GCC 14.3.0 over 13.3.0 (fanquake) 47be912 guix: disable gprofng in GCC (fanquake) ea29329 guix: build GCC with --enable-host-bind-now (fanquake) 6f54e26 guix: disable libquadmath in GCC (fanquake) 7735901 guix: disable building libgomp in GCC (fanquake) Pull request description: Switching to using GCC 14.x for release builds has come up multiple times recently. It will eventually be needed for #25573, and could also be useful for #30210. ACKs for top commit: hebasto: ACK 2a74650. I have reviewed the code and it looks OK. The new GCC patch looks reasonable. theuni: utACK 2a74650 sedited: ACK 2a74650 Tree-SHA512: 56912bed19386f06d52fb94e0ef6d96f5415ab2de8b5e94890806d7cc0b937a3c4b11cc161aa2e06ca2fd3c392ef7501c91688e0897e1c1c51aafa963f3e50d9
Use Guix to produce a
-static-piebitcoind using GCC 14.3.0 and glibc 2.42. Using glibc for static builds, would be less of a leap compared to switching to musl libc (POC in #23203).-static-piex86_64-linux-gnusize comparison:master (a7e8067)
bitcoindis15.35megabytes.This PR (597b5296d3adc693001ce39626fe32b9545eb604)
bitcoindis17.45megabytes.