Cannot figure out how to use std::atomic error for MacOS Sequoia 15.2 #31579

issue kelvinator07 openend this issue on December 30, 2024
  1. kelvinator07 commented at 0:19 am on December 30, 2024: none

    Fails to compile when running cmake -B build -DWITH_BDB=ON Attempted the build process on two different laptops with identical specifications and encountered the same error.

    Build Output:

    0-- Performing Test STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC
    1-- Performing Test STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC - Failed
    2-- Performing Test STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC
    3-- Performing Test STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC - Failed
    4CMake Error at cmake/module/TestAppendRequiredLibraries.cmake:90 (message):
    5  Cannot figure out how to use std::atomic.
    6Call Stack (most recent call first):
    7  cmake/introspection.cmake:29 (test_append_atomic_library)
    8  CMakeLists.txt:391 (include)
    

    Laptop Specifications

    • OS: macOS Sequoia 15.2
    • Compiler: Apple Clang version 16.0.0 (clang-1600.0.26.6) – Target: arm64-apple-darwin24.2.0 – Thread model: posix – InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  2. adyshimony commented at 11:40 pm on December 31, 2024: none

    Try this to solve the issue:

    1. brew install llvm
    2. Clean build / delete dir to clean cache
    3. cmake -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ -B build
  3. maflcko added the label macOS on Jan 1, 2025
  4. maflcko added the label Build system on Jan 1, 2025
  5. maflcko added this to the milestone 29.0 on Jan 1, 2025
  6. maflcko removed this from the milestone 29.0 on Jan 1, 2025
  7. maflcko commented at 6:06 pm on January 1, 2025: member
  8. hebasto commented at 9:50 am on January 2, 2025: member

    @kelvinator07

    Could you provide please the CMakeFiles/CMakeConfigureLog.yaml file from your build directory?

  9. fanquake added this to the milestone 29.0 on Jan 2, 2025
  10. kelvinator07 commented at 10:38 am on January 2, 2025: none

    @adyshimony, thank you for your helpful response! I was able to resolve the issue using the following steps:

    1. Installed LLVM via Homebrew brew install llvm
    2. Clean build / delete dir to clean cache via git clean -fxd
    3. Updated the build command to use the Homebrew-installed LLVM path, and also adding the LLVM library path:
    0cmake -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang \
    1      -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ \
    2      -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/llvm/lib -B build
    

    @maflcko, for reference, my Xcode version is 16:

    0-% pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
    1version: 16.2.0.0.1.1733547573
    

    @hebasto, thanks as well for your comment!

  11. maflcko commented at 12:05 pm on January 2, 2025: member

    version: 16.2

    Thanks. Though, I can’t reproduce in GHA (run: https://github.com/maflcko/bitcoin-core-with-ci/actions/runs/12582079644/job/35067062801#step:3:14 ). Though, I also get a different output for the clang installed dir:

    0  sudo xcode-select --switch /Applications/Xcode_16.2.app
    1  clang --version
    2
    3Apple clang version 16.0.0 (clang-1600.0.26.6)
    4Target: arm64-apple-darwin24.2.0
    5Thread model: posix
    6InstalledDir: /Applications/Xcode_16.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    
  12. richieoscar commented at 1:57 pm on January 3, 2025: none

    @adyshimony, @kelvinator07 this solution also worked for me

       Installed LLVM via homebrew brew install llvm
       Clean build / delete dir to clean cache via git clean -fxd
       Updated the build command to use the Homebrew-installed LLVM path, and also adding the LLVM library path:
    
                cmake -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang \
               -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ \
               -DCMAKE_EXE_LINKER_FLAGS=-L/opt/homebrew/opt/llvm/lib -B build
    

    xcode version

    pkgutil –pkg-info=com.apple.pkg.CLTools_Executables | grep version version: 16.2.0.0.1.1733547573

    MacOs Sequoia 15.2

    gcc –version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin24.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

    clang –version Homebrew clang version 19.1.6 Target: arm64-apple-darwin24.2.0 Thread model: posix InstalledDir: /opt/homebrew/Cellar/llvm/19.1.6/bin Configuration file: /opt/homebrew/etc/clang/arm64-apple-darwin24.cfg


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

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