Skip to content
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

docs: Windows build intructions result in a large binary #30593

Open
vostrnad opened this issue Aug 6, 2024 · 6 comments
Open

docs: Windows build intructions result in a large binary #30593

vostrnad opened this issue Aug 6, 2024 · 6 comments

Comments

@vostrnad
Copy link

vostrnad commented Aug 6, 2024

Following the intructions in doc/build-windows.md results in a bitcoind binary that's almost 440 MB. For comparison, the latest release binary is around 15 MB. Are the instructions perhaps missing a flag to create a release build or something like that? I'm using WSL.

@fanquake
Copy link
Member

fanquake commented Aug 6, 2024

It's the debug symbols. If you run strip src/bitcoind.exe you'll end up with a ~15mb binary.

@hebasto
Copy link
Member

hebasto commented Aug 6, 2024

For comparison, the latest release binary is around 15 MB.

The release binaries are stripped of debug info.

@vostrnad
Copy link
Author

vostrnad commented Aug 6, 2024

Thank you, that was it. It this something worth noting in the docs?

@willcl-ark
Copy link
Member

In a post-cmake world this is the type of thing I would expect developers to add to their own cmakuserpresets.json, although I don't see any reason it couldn't be documented too. Compiling without debug symbols is already documented in build-unix.md:

Alternatively, or in addition, debugging information can be skipped for compilation. The default compile flags are

But even building with CFLAGS and CXXFLAGS leaves some info strip is able to remove to further reduce binary size.

@reverse-hash
Copy link

reverse-hash commented Aug 15, 2024

Same issue when compiling 27.1 to build my own docker images in alpine. Same process, just switching tags.

 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
REPOSITORY       TAG           IMAGE ID       CREATED         SIZE
bitcoind         27.1          7a14ec692f8c   2 days ago      149MB
bitcoind         26.2          6fc0c7867196   4 days ago      80.1MB

Just adding the option "-s" or "--strip-all". Example: LDFLAGS="-static-libstdc++ -s" reduces the binary in 27.1 to 79 MB.

@davidgumberg
Copy link
Contributor

davidgumberg commented Sep 9, 2024

+1 to adding a note in doc/build-windows.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants