Author

Topic: When compiling bitcoind the binary doubles in size between 26.2 and 27.0 (Read 127 times)

newbie
Activity: 4
Merit: 5
--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.

Thanks a lot achow101. All clear now.
staff
Activity: 3458
Merit: 6793
Just writing some code
--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.
newbie
Activity: 4
Merit: 5
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.

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.

Thank you. After reviewing again the documentation I found the key:

Code:
Alternatively, or in addition, debugging information can be skipped for compilation. The default compile flags are -g -O2, and can be changed with: ./configure CXXFLAGS="-g0"
Doc: https://github.com/bitcoin/bitcoin/blob/43740f4971f45cd5499470b6a085b3ecd8b96d28/doc/build-unix.md

Not sure why, but -g is there by default :/.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
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.

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.
newbie
Activity: 4
Merit: 5
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:

Code:
-s
--strip-all
    Omit all symbol information from the output file.

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.
newbie
Activity: 4
Merit: 5
Hello, people,

I am asking for your help in case any of you could give me some suggestions. I have my own node working with docker and I try to keep the daemon as light as possible.

The compilation process is exactly the same for both versions, I just change the bitcoin repository version tag.

Do you know what could be the reason? You can find a link to the complete dockerfile at the end of the post.

Thanks a lot

Code:
  make HOST=$(gcc -dumpmachine) NO_QT=1 NO_ZMQ=1 NO_WALLET=1 NO_BDB=1 NO_SQLITE=1 \
  && ./autogen.sh \
  && ./configure \
    --prefix=$PWD/depends/$(gcc -dumpmachine) LDFLAGS="-static-libstdc++" \
    --disable-bench \
    --disable-cli \
    --disable-debug \
    --disable-man \
    --disable-tests \
    --disable-upnp \
    --disable-wallet \
    --disable-zmq \
    --with-qrencode=no \
    --enable-fuzz-binary=no \
    --enable-strip \
    --without-gui \
    --without-bdb \
    --with-sqlite=no \   
  && make \

Code:
REPOSITORY       TAG           IMAGE ID       CREATED         SIZE
bitcoind         27.1          7a14ec692f8c   2 days ago      149MB
bitcoind         26.2          6fc0c7867196   4 days ago      80.1MB


https://raw.githubusercontent.com/reverse-hash/bitcoin-full-node-with-docker/main/bitcoind/Dockerfile
Jump to: