Improve BSD compatibility of contrib/install_db4.sh #11945

pull laanwj wants to merge 4 commits into bitcoin:master from laanwj:2017_12_contrib_bsd changing 2 files +14 −19
  1. laanwj commented at 11:57 AM on December 19, 2017: member

    This PR improves the BSD compatibility of the bdb4 installer script.

    See #11921, #11868.

    I've tested this on OpenBSD 6.2 (clang) and Ubuntu 16.04 (gcc).

    This needs testing on OSX at least, and on gcc/Linux to make sure that applying the patch unconditionally doesn't negatively affect gcc.

    NB: this is not yet sufficient to make install_db4.sh work on FreeBSD, as we need to use yet another sha256 tool there. But it's a step in the right direction.

    contrib: New clang patch for install_db4

    Replace the clang patch with a new and improved version that also fixes the build issues with OpenBSD and FreeBSD's clang, and apply it unconditionally.

    Thanks to @fanquake for finding the patch.

    contrib: Make X=Y arguments work in install_db4

    Trailing X=Y arguments are supposed to be passed through unchanged to bdb's configure. This was not the case, at least with OpenBSD 6.2's shell.

    Fix this by not storing the arguments in a temporary variable but passing "$@" through directly.

    contrib: FreeBSD compatibility in install_db4.sh

    Unfortunately, FreeBSD uses yet another syntax for sha256.

    Support FreeBSD's syntax too. Using uname is a bit of a hack but it works and I found no way to distinguish the two.

  2. contrib: New clang patch for install_db4
    Replace the clang patch with a new and improved version that also fixes
    the build issues with OpenBSD and FreeBSD's clang, and apply it
    unconditionally.
    
    This needs testing on OSX.
    b798f9bab9
  3. contrib: Make X=Y arguments work in install_db4
    Trailing X=Y arguments are supposed to be passed through unchanged
    to bdb's configure. This was not the case, at least with OpenBSD
    6.2's shell.
    
    Fix this by not storing the arguments in a temporary variable but
    passing "$@" through directly.
    c0298b06e5
  4. laanwj added the label Build system on Dec 19, 2017
  5. laanwj added the label Scripts and tools on Dec 19, 2017
  6. fanquake commented at 1:28 PM on December 20, 2017: member

    I've tested on OS X and OpenBSD 6.2, using this commit on top of 1fb34e0d1f585dc6bb26ccbbcc26e9be4e107892, plus some of the changes to install instructions in other open PRs.

    The new patch should be ok, because it's doing the same thing we do when patching bd4 in depends.

    note: Should we bring this patch into depends, and then we can use it from there for this script?

    testedACK c0298b0

  7. contrib: FreeBSD compatibility in install_db4.sh
    Unfortunately, FreeBSD uses yet another syntax for `sha256`.
    
    Support FreeBSD's syntax too. Using `uname` is a bit of a hack but it
    works and I found no way to distinguish the two.
    d95c83d193
  8. laanwj commented at 2:00 PM on December 20, 2017: member

    Added a commit that adds FreeBSD compatibility! (and shortened the build instructions with it)

  9. doc: Update FreeBSD build instructions to use bdb4
    Use Berkeley DB 4 as recommended on other platforms.
    2712742ef2
  10. Sjors commented at 2:52 PM on December 20, 2017: member

    Tested on MacOS 10.13.2, with most dependencies installed via Homebrew (berkeley-db4 in particular):

    ./autogen
    ./configure
    

    Configure summary:

    Options used to compile and link:
      with wallet   = yes
      with gui / qt = yes
        qt version  = 5
        with qr     = yes
      with zmq      = yes
      with test     = yes
      with bench    = yes
      with upnp     = yes
      use asm       = yes
      debug enabled = no
      werror        = no
    
      target os     = darwin
      build os      = darwin
    
      CC            = /usr/local/bin/ccache gcc
      CFLAGS        = -g -O2
      CPPFLAGS      = -Qunused-arguments  -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -I/usr/local/opt/berkeley-db@4/include -DMAC_OSX
      CXX           = /usr/local/bin/ccache g++ -std=c++11
      CXXFLAGS      = -g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wthread-safety-analysis -Wno-unused-parameter -Wno-self-assign -Wno-unused-local-typedef -Wno-deprecated-register -Wno-implicit-fallthrough
      LDFLAGS       =  -Wl,-headerpad_max_install_names -Wl,-dead_strip
      ARFLAGS       = cr
    
    make
    

    make is happy, but I did notice this (not sure if that's new):

      CXX      leveldb/util/leveldb_libleveldb_a-histogram.o
      CXX      leveldb/util/leveldb_libleveldb_a-logging.o
    leveldb/util/logging.cc:58:40: warning: comparison of integers of different signs: 'const int' and 'unsigned long long' [-Wsign-compare]
              (v == kMaxUint64/10 && delta > kMaxUint64%10)) {
                                     ~~~~~ ^ ~~~~~~~~~~~~~
    1 warning generated.
      CXX      leveldb/util/leveldb_libleveldb_a-options.o
      CXX      leveldb/util/leveldb_libleveldb_a-status.o
      CXX      leveldb/port/leveldb_libleveldb_a-port_posix.o
      AR       leveldb/libleveldb.a
    
    make check
    test/functional/test_runner.py
    make deploy
    

    All tests pass with the exception of rawtransactions.py (logs), unrelated?

    I can see my transactions in BitcoinQT.

  11. laanwj commented at 3:30 PM on December 20, 2017: member

    Thanks for testing!

    All tests pass with the exception of rawtransactions.py (logs), unrelated?

    Yes, expected: that's the problem fixed in #11947. This PR was branched off before that (note that travis doesn't flag it). The leveldb warning is old, and also unrelated.

  12. in contrib/install_db4.sh:34 in d95c83d193 outdated
      30 | @@ -31,7 +31,11 @@ sha256_check() {
      31 |    if check_exists sha256sum; then
      32 |      echo "${1}  ${2}" | sha256sum -c
      33 |    elif check_exists sha256; then
      34 | -    echo "${1}  ${2}" | sha256 -c
      35 | +    if [ "$(uname)" = "FreeBSD" ]; then
    


    theuni commented at 10:29 PM on December 20, 2017:

    I believe we work around this in depends by writing to a temp file rather than piping, as all tools manage to deal with that. I think this is fine here, though.


    laanwj commented at 7:56 AM on December 21, 2017:

    Indeed! I also thought about rewriting the whole function - to hash the file, grab the output, then compare the hash ourselves. Unfortunately the output format is also different per tool, so it wouldn't get fully clean code either. But yes - we could still do that later, at least this is a minor diff that obviously won't affect any other OS.

  13. theuni commented at 10:38 PM on December 20, 2017: member

    utACK 2712742ef2947feef4a142f7d1360d1e821597dc

  14. fanquake commented at 1:00 AM on December 21, 2017: member

    re-ACK 2712742

  15. laanwj merged this on Dec 21, 2017
  16. laanwj closed this on Dec 21, 2017

  17. laanwj referenced this in commit 7a11ba7e01 on Dec 21, 2017
  18. laanwj added the label Needs backport on Dec 21, 2017
  19. fanquake removed the label Needs backport on Mar 7, 2018
  20. DrahtBot locked this on Sep 8, 2021

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-13 15:15 UTC

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