ci: Use Homebrew's gcc in native macOS task #1402

pull hebasto wants to merge 1 commits into bitcoin-core:master from hebasto:230816-brew-gcc changing 2 files +8 −0
  1. hebasto commented at 10:32 AM on August 16, 2023: member

    Fixes an issue noticed in #1394 (comment):

    This uses the wrong GCC, namely Clang

    When CC=gcc:

    + gcc -v
    Apple clang version 14.0.3 (clang-1403.0.22.14.1)
    Target: arm64-apple-darwin22.5.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
    
    • with this PR:
    + gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/13.1.0/bin/../libexec/gcc/aarch64-apple-darwin22/13/lto-wrapper
    Target: aarch64-apple-darwin22
    Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-13 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 13.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin22 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk
    Thread model: posix
    Supported LTO compression algorithms: zlib zstd
    gcc version 13.1.0 (Homebrew GCC 13.1.0) 
    
  2. in .cirrus.yml:141 in 7fdfb6ed43 outdated
     139 | +    - env: {WIDEMUL: int128,  RECOVERY: yes, ECDH: yes, SCHNORRSIG: yes, ELLSWIFT: yes, CC: gcc-13}
     140 |      - env: {WIDEMUL: int128,  RECOVERY: yes, ECDH: yes, SCHNORRSIG: yes, ELLSWIFT: yes, CPPFLAGS: -DVERIFY}
     141 |      - env: {BUILD: distcheck}
     142 |    brew_script:
     143 | -    - brew install automake libtool gcc
     144 | +    - brew install automake libtool gcc@13
    


    real-or-random commented at 10:42 AM on August 16, 2023:

    nit: What about keeping "gcc" (without @13) and simply adding ln -sf /usr/local/bin/gcc-* /usr/bin/gcc? This is independent of the version, and it will make it easier not to screw up in the future?


    hebasto commented at 10:49 AM on August 16, 2023:

    Thanks! Done.


    hebasto commented at 11:30 AM on August 16, 2023:

    nit: What about keeping "gcc" (without @13) and simply adding ln -sf /usr/local/bin/gcc-* /usr/bin/gcc? This is independent of the version, and it will make it easier not to screw up in the future?

    ln -sf /usr/local/bin/gcc-* /usr/bin/gcc
    ln: /usr/bin/gcc: Read-only file system
    

    real-or-random commented at 11:44 AM on August 16, 2023:

    Oh, it fails, sorry. ("Read-only file system") I suggest this instead:

    ln -s /opt/homebrew/bin/gcc-?? /opt/homebrew/bin/gcc
    

    (Tested to work using Cirrus CI console.)


    hebasto commented at 1:08 PM on August 16, 2023:

    Done.

  3. hebasto force-pushed on Aug 16, 2023
  4. real-or-random commented at 11:19 AM on August 16, 2023: contributor

    We could add this to cirrus.sh to prevent these issues in the future:

    # If gcc is requested, assert that it's in fact gcc (and not some symlinked Apple clang)
    if [[ $CC == *gcc* ]] && ! $CC -v 2>&1 | grep -q "gcc version"; then exit 1; fi
    
  5. real-or-random added the label ci on Aug 16, 2023
  6. hebasto force-pushed on Aug 16, 2023
  7. hebasto commented at 1:08 PM on August 16, 2023: member

    We could add this to cirrus.sh to prevent these issues in the future:

    # If gcc is requested, assert that it's in fact gcc (and not some symlinked Apple clang)
    if [[ $CC == *gcc* ]] && ! $CC -v 2>&1 | grep -q "gcc version"; then exit 1; fi
    

    Adopted for https://github.com/bitcoin-core/secp256k1/blob/eedd781085b1f6587ba6e91656fada5f6861a693/ci/cirrus.sh#L1 and implemented.

  8. ci: Use Homebrew's gcc in native macOS task
    Co-authored-by: Tim Ruffing <crypto@timruffing.de>
    d62db57427
  9. hebasto force-pushed on Aug 16, 2023
  10. real-or-random approved
  11. real-or-random commented at 2:29 PM on August 16, 2023: contributor

    ACK d62db57427f60da57f936cbe049ee27b10c3f8d4, it works: https://cirrus-ci.com/task/6200190252613632?logs=test#L27

  12. real-or-random merged this on Aug 16, 2023
  13. real-or-random closed this on Aug 16, 2023

  14. hebasto deleted the branch on Aug 16, 2023
  15. sipa referenced this in commit c0da4f60e2 on Sep 4, 2023
  16. Retropex referenced this in commit 5f62ed90f6 on Oct 4, 2023
  17. real-or-random referenced this in commit d575ef9aca on Oct 12, 2023
  18. janus referenced this in commit 1097330147 on Apr 1, 2024
  19. hebasto referenced this in commit b6de625950 on May 11, 2024
  20. delta1 referenced this in commit 6089844b3c on Apr 2, 2025
  21. div72 referenced this in commit af627d47c3 on Apr 12, 2025
  22. str4d referenced this in commit b9e749419a on Jun 4, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-19 06:52 UTC