Binary size of bitcoind skyrockets from 26.2 to 27.0

5 replies 379 views
DarkBullMember
Posts: 15 · Reputation: 173
#1Nov 25, 2022, 03:57 PM
Hey everyone, I could really use your input here. I've got my own node running on docker, and I’m trying to keep the daemon as lightweight as I can. The way I compile is the same for both versions; I just swap out the version tag in the bitcoin repo. Any ideas on what could be causing this? I’ll drop a link to the full dockerfile at the end of the post. Thanks a ton https://raw.githubusercontent.com/reverse-hash/bitcoin-full-node-with-docker/main/bitcoind/Dockerfile
3 Reply Quote Share
DarkBullMember
Posts: 15 · Reputation: 173
#2Nov 25, 2022, 09:43 PM
I found the solution. I share it just in case it can be useful for someone. In the LDFLAGS , just add the option "-s" or "--strip-all". Example: LDFLAGS="-static-libstdc++ -s" According to GNU linker (ld) documentation: In summary, symbol information is essential during development and debugging, but for a final product, especially if we're looking to optimize size, it can be removed without affecting the functionality of the executable.
2 Reply Quote Share
alex.gw31Member
Posts: 33 · Reputation: 218
#3Nov 25, 2022, 10:55 PM
That makes sense, since the symbols are the only way I can think of that make a binary with otherwise a few changes grow really large in size. Is it possible that the build steps are running with the -g flag somewhere inside the configure script or the automake file? Because Bitcoin Core3 is not supposed to be including debug info by default.
1 Reply Quote Share
DarkBullMember
Posts: 15 · Reputation: 173
#4Nov 27, 2022, 06:09 PM
Thank you. After reviewing again the documentation I found the key: Doc: https://github.com/bitcoin/bitcoin/blob/43740f4971f45cd5499470b6a085b3ecd8b96d28/doc/build-unix.md Not sure why, but -g is there by default :/.
3 Reply Quote Share
byte_f4rmMember
Posts: 10 · Reputation: 172
#5Nov 27, 2022, 07:02 PM
--disable-debug is slightly misleading. It doesn't disable the inclusion of the debug symbols; rather it disables optimizations that make debugging very difficult. Unless you override CFLAGS and/or CXXFLAGS, the debug symbols will always be included. For releases, we run strip on the result to produce a release binary with no debug symbols, and a separate file containing the debug symbols. This is all likely to change very soon anyways as we switch to using cmake.
2 Reply Quote Share
DarkBullMember
Posts: 15 · Reputation: 173
#6Nov 28, 2022, 08:53 AM
Thanks a lot achow101. All clear now.
2 Reply Quote Share

Related topics