Docs: Include hint to use `make clean` in build-unix.md #19330

issue billygarrison opened this issue on June 19, 2020
  1. billygarrison commented at 7:46 PM on June 19, 2020: contributor

    Is your feature request related to a problem? Please describe. When running make while there are other pre-existing builds, there can be errors that don't clearly suggest using make clean. This step may be obvious to experienced developers, but is confusing to many bitcoin users without a background in C/Make. Currently, build-unix.md does not mention using make clean.

    Describe the solution you'd like A simple fix would be to include a hint in the "To build" section of build-unix.md. I'd be happy to make the change myself, but wanted to get feedback first to avoid wasting reviewers' time.

    Other changes build-osx.md also uses make, as does the Windows Subsystem for Linux instructions. Those could be updated with the same note. I'm not familiar with the BSD systems, but the docs say they use gmake, which also appears to have a gmake clean option.

    Related issue #16479

  2. billygarrison added the label Feature on Jun 19, 2020
  3. hebasto commented at 12:02 PM on June 20, 2020: member

    This step may be obvious to experienced developers, but is confusing to many bitcoin users without a background in C/Make.

    Such users run make once only, no?

  4. billygarrison commented at 12:12 PM on June 20, 2020: contributor

    This step may be obvious to experienced developers, but is confusing to many bitcoin users without a background in C/Make.

    Such users run make once only, no?

    I ran into the issue when upgrading to the latest version. I'm familiar with git but had no idea about make clean.

    Steps to upgrade

    cd bitcoin
    git fetch origin
    git reset --hard origin/master
    git checkout v0.20.0
    ./autogen.sh
    ./configure
    make
    make install
    
  5. hebasto commented at 12:58 PM on June 20, 2020: member

    @billygarrison

    I ran into the issue when upgrading to the latest version. I'm familiar with git but had no idea about make clean.

    That makes sense :)

  6. jonatack commented at 1:17 PM on June 20, 2020: member

    @billygarrison if helpful to you, I wrote about this here, don't hesitate to look through the article: https://jonatack.github.io/articles/how-to-compile-bitcoin-core-and-run-the-tests. Here's a relevant paragraph:

    "On the other hand, when you change the build configuration, and in some cases when testing different PRs, or when the build isn't working, it's often best to start with a clean slate using make clean or make distclean before configuring. Here's a complete example, courtesy of Marco Falke:"

    ./autogen.sh && ./configure <any BDB flags> && make distclean && ./configure <all flags> && make 
    

    (p.s. git reset --hard origin/master seems unnecessary)

  7. MarcoFalke commented at 1:43 PM on June 20, 2020: member

    btw I switched my compile alias to ./autogen.sh && ./configure --enable-c++17 CC=clang CXX=clang++ && make clean && make check, because the double-configure seemed overkill

  8. hebasto commented at 1:47 PM on June 20, 2020: member

    FWIW, I have a bunch of aliases:

    $ alias
    ...
    alias conf-clang='./autogen.sh && ./configure --with-incompatible-bdb CC=clang-9 CXX=clang++-9 && make clean > /dev/null'
    alias conf-clang-debug='./autogen.sh && ./configure --enable-debug --with-incompatible-bdb CC=clang-9 CXX=clang++-9 && make clean > /dev/null'
    alias conf-fuzz='./autogen.sh && ./configure --enable-c++17 --enable-fuzz --with-sanitizers=fuzzer,address,undefined CC=clang-9 CXX=clang++-9 && make clean > /dev/null'
    alias conf-gcc='./autogen.sh && ./configure --with-incompatible-bdb && make clean > /dev/null'
    alias conf-gcc-17='./autogen.sh && ./configure --with-incompatible-bdb --enable-c++17 && make clean > /dev/null'
    alias conf-gcc-debug='./autogen.sh && ./configure --enable-debug --with-incompatible-bdb && make clean > /dev/null'
    ...
    

    :smiley:

  9. jonatack commented at 1:54 PM on June 20, 2020: member

    btw I switched my compile alias to ./autogen.sh && ./configure --enable-c++17 CC=clang CXX=clang++ && make clean && make check, because the double-configure seemed overkill

    Thanks @MarcoFalke, will update. I was wondering if the benefit of double configuring was worth it.


    @hebasto interesting, thanks, I have a bunch too at https://github.com/jonatack/dotfiles/blob/master/bash_aliases#L331 which has turned a bit into flag soup :D ... always interesting to see what others are doing to keep sharpening the tools.

    (Edit for casual observers: Don't use these bash aliases for building to run a node in production! They are for testing and debugging purposes and the builds with them run much more slowly.)

  10. MarcoFalke commented at 3:07 PM on June 20, 2020: member

    Another one to run a command on the commits of a branch: (I think already mentioned in productivity.md)

    $ which tbc  # test bitcoin core
    tbc ()
    { 
        git rebase --interactive --exec "make check -j 9 && ./test/functional/test_runner.py -j 9" $(git merge-base bitcoin-core/master HEAD)
    }
    

    Edit: :) https://github.com/bitcoin/bitcoin/blob/master/doc/productivity.md#interactive-dummy-rebases-for-fixups-and-execs-with-git-merge-base

  11. fanquake commented at 9:15 AM on March 29, 2022: member

    Going to close this for now. I don't think we need to add/maintain basic make usage notes in our build documentation.

  12. fanquake closed this on Mar 29, 2022

  13. DrahtBot locked this on Mar 29, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me