depends: Override host compilers for FreeBSD and OpenBSD #32716

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:250610-depends-bsd changing 2 files +8 −0
  1. hebasto commented at 2:02 pm on June 10, 2025: member

    When building depends on FreeBSD/OpenBSD aarch64, the host compilers default to default_host_{CC,CXX}, which resolves to gcc/g++. This is incorrect on these systems, where Clang is the default system compiler.

    To ensure proper compiler selection, this PR adopts the same approach used for darwin:https://github.com/bitcoin/bitcoin/blob/c1d4253d316ea627f46b26e395d7b48842258381/depends/builders/darwin.mk#L12-L14

    Fixes #32691.

  2. depends: Override host compilers for FreeBSD and OpenBSD
    When building depends on FreeBSD/OpenBSD `aarch64`, the host compilers
    default to `default_host_{CC,CXX}`, which resolves to `gcc`/`g++`. This
    is incorrect on these systems, where Clang is the default system
    compiler.
    4f10a57671
  3. hebasto added the label Build system on Jun 10, 2025
  4. DrahtBot commented at 2:02 pm on June 10, 2025: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32716.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK Sjors

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  5. Sjors commented at 3:35 pm on June 10, 2025: member

    ACK 4f10a57671c19cacca630b2401e42a213aacff1b

    I tested that this fixes #32691 on an aarch64 OpenBSD VM, and doesn’t break anything on an x86 VM.

    I didn’t test FreeBSD.

    While testing this I noticed the depends build doesn’t bother creating qt. It’s not obvious to me why that is and doesn’t seem to be documented. The non-depends instructions for *BSD do include qt6.

  6. hebasto commented at 4:08 pm on June 10, 2025: member
    cc @vasild
  7. hebasto commented at 2:44 pm on June 11, 2025: member
  8. theuni commented at 3:06 pm on June 11, 2025: member

    Since gcc (and thus $(host_toolchain)gcc) is basically never the right option for these, I’m wondering if we should just do something like:

     0diff --git a/depends/hosts/freebsd.mk b/depends/hosts/freebsd.mk
     1index 009d215f82f..0a9d8bb423d 100644
     2--- a/depends/hosts/freebsd.mk
     3+++ b/depends/hosts/freebsd.mk
     4@@ -7,25 +7,24 @@ freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS)
     5 freebsd_debug_CFLAGS=-O1 -g
     6 freebsd_debug_CXXFLAGS=$(freebsd_debug_CFLAGS)
     7
     8+freebsd_CC=clang
     9+freebsd_CXX=clang++
    10+
    11+ifneq ($(host),$(build))
    12+freebsd_CC+=-target $(canonical_host)
    13+freebsd_CXX+=-target $(canonical_host)
    14+endif
    15+
    16 ifeq (86,$(findstring 86,$(build_arch)))
    17-i686_freebsd_CC=clang -m32
    18-i686_freebsd_CXX=clang++ -m32
    19 i686_freebsd_AR=ar
    20 i686_freebsd_RANLIB=ranlib
    21 i686_freebsd_NM=nm
    22 i686_freebsd_STRIP=strip
    23
    24-x86_64_freebsd_CC=clang -m64
    25-x86_64_freebsd_CXX=clang++ -m64
    26 x86_64_freebsd_AR=ar
    27 x86_64_freebsd_RANLIB=ranlib
    28 x86_64_freebsd_NM=nm
    29 x86_64_freebsd_STRIP=strip
    30-else
    31-i686_freebsd_CC=$(default_host_CC) -m32
    32-i686_freebsd_CXX=$(default_host_CXX) -m32
    33-x86_64_freebsd_CC=$(default_host_CC) -m64
    34-x86_64_freebsd_CXX=$(default_host_CXX) -m64
    35 endif
    36
    37 freebsd_cmake_system_name=FreeBSD
    
  9. hebasto commented at 3:18 pm on June 11, 2025: member

    Since gcc (and thus $(host_toolchain)gcc) is basically never the right option for these, I’m wondering if we should just do something like…

    I’d considered this option and another one. I chose the current approach for two reasons: (a) it results in a minimal diff, and (b) it avoids changing compiler flags on the x86_64 and i686 build platforms.


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: 2025-06-12 21:13 UTC

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