build: support OpenBSD in depends #23998

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:depends_support_openbsd changing 13 files +98 −8
  1. fanquake commented at 7:57 am on January 7, 2022: member

    Completes the BSD trifecta. No Qt. Includes a commit that adds a default build_TAR to depends, to make it easier to override and use gnu/gtar, as OpenBSDs tar does not support some of the options we use. Also includes this patch, https://github.com/boostorg/test/commit/684f067dde3b798877655cdda4eab8d7c26b2510, to fix a compilation issue in Boost test.

    Have tested on OpenBSD 7.0 with:

    0gmake -C depends -j9
    1./autogen.sh
    2CONFIG_SITE=/home/vagrant/bitcoin/depends/amd64-unknown-openbsd7.0/share/config.site ./configure --disable-external-signer MAKE=gmake
    3gmake check -j9
    
  2. fanquake added the label Build system on Jan 7, 2022
  3. DrahtBot commented at 9:08 am on January 7, 2022: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #24301 (build: header-only Boost by fanquake)
    • #23955 (build: add support for NetBSD in depends by fanquake)
    • #23571 (build: Propagate user-defined tools to native packages by hebasto)
    • #22811 (build: Fix depends build system when working with subtargets by hebasto)
    • #22708 (build, qt: Add Wayland support for Linux builds with depends by hebasto)
    • #21995 (build: Make built dependency packages reproducible by hebasto)
    • #19952 (build, ci: Add file-based logging for individual packages by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. in depends/packages/libevent.mk:15 in 36d221d20a outdated
    11@@ -12,6 +12,7 @@ define $(package)_set_vars
    12   $(package)_config_opts += --disable-dependency-tracking --enable-option-checking
    13   $(package)_config_opts_release=--disable-debug-mode
    14   $(package)_config_opts_linux=--with-pic
    15+  $(package)_config_opts_openbsd=--with-pic  
    


    MarcoFalke commented at 8:43 am on January 8, 2022:
    0  $(package)_config_opts_openbsd=--with-pic
    

    fanquake commented at 0:21 am on January 10, 2022:
    Addressed.
  5. fanquake force-pushed on Jan 10, 2022
  6. fanquake force-pushed on Jan 19, 2022
  7. theStack commented at 6:35 pm on January 24, 2022: member
    Concept ACK
  8. DrahtBot added the label Needs rebase on Feb 2, 2022
  9. MarcoFalke added the label DrahtBot Guix build requested on Feb 2, 2022
  10. fanquake force-pushed on Feb 3, 2022
  11. DrahtBot removed the label Needs rebase on Feb 3, 2022
  12. theStack commented at 3:05 pm on February 3, 2022: member

    I could successfully build and run the tests on OpenBSD 7.0 with the instructions provided in the PR description. However, I had to prepend TAR=gtar to the first gmake call, otherwise it would fail due to the base system tar not supporting the needed options.

    Is this supposed to be specified by the user or was the idea to set TAR=gtar by default in the Makefile on OpenBSD?

  13. laanwj commented at 9:07 am on February 10, 2022: member

    We need to document the needed packages/ports somewhere (in build-openbsd.md would be the most likely place? or maybe in depend’s README.md):

    0pkg_add gtar bash
    
    • gtar as mentioned
    • bash for gen_id only i think, not installing it will give the following output but it seems to proceed otherwise:
    0env: ./gen_id: No such file or directory
    1env: ./gen_id: No such file or directory
    
  14. fanquake force-pushed on Feb 10, 2022
  15. fanquake commented at 9:42 am on February 10, 2022: member

    Rebased.

    Is this supposed to be specified by the user or was the idea to set TAR=gtar by default in the Makefile on OpenBSD?

    Made a (currently untested) change such that using gtar should be set automatically, so no need to specify TAR=gtar when building.

    We need to document the needed packages/ports somewhere

    I’ve added these to the depends README.

  16. laanwj commented at 9:50 am on February 10, 2022: member

    Thanks! Updated to commit 8793ee3a9df92f9f37c2abc5be3e088b56751e69. I don’t think the automatic workaround is working. gtar is installed but:

    0Extracting native_b2...
    1(SHA256) /home/user/bitcoin/depends/sources/boost_1_71_0.tar.bz2: OK
    2tar: unknown option -- -
    3usage: tar {crtux}[014578befHhjLmNOoPpqsvwXZz]
    4           [blocking-factor | archive | replstr] [-C directory] [-I file]
    5           [file ...]
    6       tar {-crtux} [-014578eHhjLmNOoPpqvwXZz] [-b blocking-factor]
    7           [-C directory] [-f archive] [-I file] [-s replstr] [file ...]
    8gmake: *** [funcs.mk:282: /home/user/bitcoin/depends/work/build/amd64-unknown-openbsd7.0/native_b2/1_71_0-091b88c6ae3/.stamp_extracted] Error 1
    

    Adding TAR=gtar gets it through that.

  17. laanwj commented at 11:30 am on February 10, 2022: member

    zeromq build fails with:

    0Provide an AUTOCONF_VERSION environment variable, please
    1autogen.sh: error: autoreconf exited with status 127
    2gmake: *** [funcs.mk:283: /home/user/bitcoin/depends/work/build/amd64-unknown-openbsd7.0/zeromq/4.3.4-a71c7ab8497/./.stamp_configured] Error 1
    

    same as or the normal build instructions, i suppose:

    0export AUTOCONF_VERSION=2.69
    1export AUTOMAKE_VERSION=1.16
    
  18. fanquake force-pushed on Feb 10, 2022
  19. fanquake commented at 12:23 pm on February 10, 2022: member

    I don’t think the automatic workaround is working. gtar is installed but:

    Sorry, should be addressed now. I’ve reworked how it’s set. Will test shortly myself.

  20. build: add a default build tar in depends
    This is so we can override it later for BSDs.
    75ae39eeec
  21. build: add support for OpenBSD to depends 471d15536f
  22. fanquake force-pushed on Feb 10, 2022
  23. laanwj commented at 2:59 pm on February 10, 2022: member

    The gtar issue is fixed. I didn’t have to explicitly specify it this time. It succeeds in building the default dependencies (except Qt, as documented).

    However, running into the following during configure:

    Edit: never mind, I did something wrong with command line arguments I think. It works now!

  24. laanwj commented at 3:55 pm on February 10, 2022: member
    Tested ACK 471d15536f12889077578884fca33d1b0930fd66 I did a depends build on OpenBSD 7.0, then built bitcoind, and ran both the unit tests and functional tests succesfully. I also checked with ldd that all depends were linked statically.
  25. fanquake commented at 5:35 pm on February 10, 2022: member
    @theStack would you like to take another look here?
  26. in depends/packages/qt.mk:204 in 471d15536f
    200@@ -201,11 +201,11 @@ define $(package)_extract_cmds
    201   echo "$($(package)_qttools_sha256_hash)  $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
    202   $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
    203   mkdir qtbase && \
    204-  tar --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
    205+  $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
    


    laanwj commented at 11:48 am on February 11, 2022:
    I think it’s fine to require gtar—but I think if someone really wanted, they could work around this without any special tar options. I don’t really understand --no-same-owner here at all (it’s only relevant when running this as root, and who builds as root?). --strip-components=1 will be harder to replace (but not impossible as the first component will be predictable based on the archive name IIRC).
  27. theStack approved
  28. theStack commented at 6:16 pm on February 11, 2022: member

    Tested ACK 471d15536f12889077578884fca33d1b0930fd66 (on OpenBSD 7.0, amd64)

    gtar is now selected automatically. If it’s missing, the message “gtar: not found” appears and the build is aborted:

    0$ gmake -C depends/ -j4
    1gmake: Entering directory '/home/honey/bitcoin_prrev/depends'
    2Extracting native_b2...
    3(SHA256) /home/honey/bitcoin_prrev/depends/sources/boost_1_71_0.tar.bz2: OK
    4/bin/sh: gtar: not found
    5gmake: *** [funcs.mk:282: /home/honey/bitcoin_prrev/depends/work/build/amd64-unknown-openbsd7.0/native_b2/1_71_0-c97b4ba1fa7/.stamp_extracted] Error 127
    6gmake: Leaving directory '/home/honey/bitcoin_prrev/depends'
    

    After installing gtar ($ doas pkg_add gtar) the build succeeds with the instruction in the PR description.

    I did a depends build on OpenBSD 7.0, then built bitcoind, and ran both the unit tests and functional tests succesfully. I also checked with ldd that all depends were linked statically.

    Did the same and can confirm that everything succeeds and the only dynamically linked libraries in bitcoind belong to the base system (libpthread, libz, libm, libc++, libc++abi, libc, ld) and not to depends.

  29. fanquake merged this on Feb 11, 2022
  30. fanquake closed this on Feb 11, 2022

  31. fanquake deleted the branch on Feb 11, 2022
  32. sidhujag referenced this in commit 1b650e7c8a on Feb 12, 2022
  33. MarcoFalke removed the label DrahtBot Guix build requested on Feb 12, 2022
  34. fanquake referenced this in commit 4aaa74e947 on Mar 25, 2022
  35. sidhujag referenced this in commit 7449f8cabb on Apr 2, 2022
  36. DrahtBot locked this on Feb 12, 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: 2024-11-17 00:12 UTC

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