build: make macOS build Clang only #30206

issue fanquake openend this issue on May 30, 2024
  1. fanquake commented at 3:58 pm on May 30, 2024: member

    It should be possible to have a macOS (release) build environment that only uses Clang, and has no GCC toolchain installed.

    Currently that’s not possible, because Qt still reaches out to g++. This can be demo’d by Guix building this branch: https://github.com/fanquake/bitcoin/tree/guix_macos_no_gcc, which removes the gcc-toolchain package, and associated build infra from the macOS env. It will fail with:

    0Configuring qt...
    1Creating qmake...
    2make[1]: Entering directory '/bitcoin/depends/work/build/arm64-apple-darwin/qt/5.15.13-35fa99bb44b/qtbase/qmake'
    3make[1]: g++: No such file or directory
    4make[1]: *** [Makefile:250: main.o] Error 127
    

    TODO:

    • Make Qt work properly with just Clang.
  2. fanquake added the label Build system on May 30, 2024
  3. fanquake referenced this in commit 0f0c89e3e4 on Jul 23, 2024
  4. fanquake referenced this in commit e24d2bbe40 on Jul 23, 2024
  5. fanquake referenced this in commit 8b41ede55e on Jul 23, 2024
  6. fanquake referenced this in commit 115e241ec6 on Jul 24, 2024
  7. fanquake referenced this in commit 98f077bf6d on Jul 25, 2024
  8. davidgumberg referenced this in commit 27db7e8725 on Jul 29, 2024
  9. hebasto commented at 9:57 pm on March 21, 2025: member
    Here is a working proof of concept based on the branch from #30997. The last commit makes the macOS builds on Guix Clang only.
  10. fanquake commented at 2:54 am on March 22, 2025: member

    The last commit makes the macOS builds on Guix Clang only.

    Seems like that commit is missing the diff to actually remove the GCC toolchain from the macOS build? Applying that causes the build to fail:

     0diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm
     1index 4e7e955218..f1e3db81c8 100644
     2--- a/contrib/guix/manifest.scm
     3+++ b/contrib/guix/manifest.scm
     4@@ -544,7 +544,6 @@ inspecting signatures in Mach-O binaries.")
     5         gzip
     6         xz
     7         ;; Build tools
     8-        gcc-toolchain-13
     9         cmake-minimal
    10         gnu-make
    11         ;; Scripting
    12@@ -556,12 +555,14 @@ inspecting signatures in Mach-O binaries.")
    13   (let ((target (getenv "HOST")))
    14     (cond ((string-suffix? "-mingw32" target)
    15            (list zip
    16+                 gcc-toolchain-13
    17                  (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32")
    18                  nsis-x86_64
    19                  nss-certs
    20                  osslsigncode))
    21           ((string-contains target "-linux-")
    22            (list bison
    23+                 gcc-toolchain-13
    24                  pkg-config
    25                  (list gcc-toolchain-13 "static")
    26                  (make-bitcoin-cross-toolchain target)))
    
  11. hebasto commented at 6:28 pm on March 27, 2025: member

    The last commit makes the macOS builds on Guix Clang only.

    Seems like that commit is missing the diff to actually remove the GCC toolchain from the macOS build? Applying that causes the build to fail:

     0diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm
     1index 4e7e955218..f1e3db81c8 100644
     2--- a/contrib/guix/manifest.scm
     3+++ b/contrib/guix/manifest.scm
     4@@ -544,7 +544,6 @@ inspecting signatures in Mach-O binaries.")
     5         gzip
     6         xz
     7         ;; Build tools
     8-       gcc-toolchain-13
     9         cmake-minimal
    10         gnu-make
    11         ;; Scripting
    12@@ -556,12 +555,14 @@ inspecting signatures in Mach-O binaries.")
    13   (let ((target (getenv "HOST")))
    14     (cond ((string-suffix? "-mingw32" target)
    15            (list zip
    16+                 gcc-toolchain-13
    17                  (make-mingw-pthreads-cross-toolchain "x86_64-w64-mingw32")
    18                  nsis-x86_64
    19                  nss-certs
    20                  osslsigncode))
    21           ((string-contains target "-linux-")
    22            (list bison
    23+                 gcc-toolchain-13
    24                  pkg-config
    25                  (list gcc-toolchain-13 "static")
    26                  (make-bitcoin-cross-toolchain target)))
    

    This branch addresses your comment. However, it is still just a proof of concept.


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-04-02 00:13 UTC

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