Recently upgraded cmake to 4.4 and encountered a build issue on master. It appears to be caused by a change in cmake to how it finds SQLite3:
https://cmake.org/cmake/help/latest/release/4.3.html#modules
The FindSQLite3 module now provides imported targets with the SQLite3:: prefix.
Despite sqlite being installed via homebrew, cmake finds the MacOS.sdk version, and imports system headers before llvm or clang headers, causing the compiler to forget what a 32 bit integer is 🤷
-- Found SQLite3: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libsqlite3.tbd (found suitable version "3.43.2", minimum required is "3.7.17")
The build completes successfully by adding the flag -DSQLite3_ROOT="$(brew --prefix sqlite)"
-- Found SQLite3: /opt/homebrew/opt/sqlite/lib/libsqlite3.dylib (found suitable version "3.53.2", minimum required is "3.7.17")
Summary:
macos 14.8.2 Clang 22.1.7 Cmake 4.4.2 bitcoin master at a8b582ec1d25e012731fcca122552b59f8967610
Relevant environment variables:
MACOSX_DEPLOYMENT_TARGET=14.5
CXX=/opt/homebrew/opt/llvm/bin/clang++
LDFLAGS=-L/opt/homebrew/opt/llvm/lib
CPPFLAGS=-I/opt/homebrew/opt/llvm/include
HOMEBREW_CELLAR=/opt/homebrew/Cellar
HOMEBREW_REPOSITORY=/opt/homebrew
CC=/opt/homebrew/opt/llvm/bin/clang
CXX=/opt/homebrew/opt/llvm/bin/clang++
Reproducable:
git clean -xdf
ccache -c
rm -rf ~/Library/Caches/ccache/
cmake -B build -DWITH_ZMQ=ON -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j 1
First build error of many:
[ 3%] Building CXX object src/wallet/CMakeFiles/bitcoin_wallet.dir/coincontrol.cpp.o
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/wallet/coincontrol.cpp:5:
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/wallet/coincontrol.h:8:
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/outputtype.h:9:
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/addresstype.h:9:
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/pubkey.h:10:
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/hash.h:10:
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/crypto/common.h:8:
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/compat/endian.h:8:
In file included from /Users/matthewzipkin/Desktop/work/bitcoin/src/compat/byteswap.h:8:
In file included from /opt/homebrew/Cellar/llvm/22.1.7/bin/../include/c++/v1/cstdint:149:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdint.h:52:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types.h:33:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_types.h:34:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/_types.h:16:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_ptrdiff_t.h:41:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stddef.h:64:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_types.h:43:9: error: unknown type name '__uint32_t'
43 | typedef __uint32_t __darwin_wctype_t;
| ^
GPT pointed this out as the smoking gun:
--> cmake --build build --verbose -j1 2>&1 | grep -m1 'clang++' cd /Users/matthewzipkin/Desktop/work/bitcoin/build/src/wallet && /opt/homebrew/bin/ccache /opt/homebrew/opt/llvm/bin/clang++ -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -I/Users/matthewzipkin/Desktop/work/bitcoin/build/src -I/Users/matthewzipkin/Desktop/work/bitcoin/src -I/Users/matthewzipkin/Desktop/work/bitcoin/src/univalue/include -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -isystem /opt/homebrew/Cellar/boost/1.87.0/include -O2 -g -std=c++20 -arch arm64 -mmacosx-version-min=14.5 -fPIC -fmacro-prefix-map=/Users/matthewzipkin/Desktop/work/bitcoin/src=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -mbranch-protection=bti -Wall -Wextra -Wgnu -Wcovered-switch-default -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wthread-safety-pointer -Wloop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wdocumentation -Wself-assign -Wundef -Wno-unused-parameter -MD -MT src/wallet/CMakeFiles/bitcoin_wallet.dir/coincontrol.cpp.o -MF CMakeFiles/bitcoin_wallet.dir/coincontrol.cpp.o.d -o CMakeFiles/bitcoin_wallet.dir/coincontrol.cpp.o -c /Users/matthewzipkin/Desktop/work/bitcoin/src/wallet/coincontrol.cpp
... because it's adding -isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include too early