Categories
Asia Australia Bitcoin bitcoin-core bitcoin-core-development bitcoind Blockchain Canada Comeback compiling Crash Crypto Europe installation Launch Markets Merge Mining Minting Rates Security Spain Trading United States

Cannot build bitcoin source on macOS

I am following https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md guide for installing bitcoin from source(master branch) on my mac.
After installing the minimal dependencies and ./autogen.sh I ran ./configure --with-gui=no whose output looks like

checking for x86_64-apple-darwin13.4.0-pkg-config... no
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking build system type... x86_64-apple-darwin13.4.0
checking host system type... x86_64-apple-darwin13.4.0
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether /usr/bin/g++ accepts -g... yes
checking for /usr/bin/g++ option to enable C++11 features... none needed
checking whether make supports the include directive... yes (GNU style)
checking dependency style of /usr/bin/g++... gcc3
checking whether /usr/bin/g++ supports C++17 features with -std=c++17... no
checking whether /usr/bin/g++ supports C++17 features with +std=c++17... no
checking whether /usr/bin/g++ supports C++17 features with -h std=c++17... no
checking whether /usr/bin/g++ supports C++17 features with -std=c++1z... no
checking whether /usr/bin/g++ supports C++17 features with +std=c++1z... no
checking whether /usr/bin/g++ supports C++17 features with -h std=c++1z... no
configure: error: *** A compiler with support for C++17 language features is required.

INFO:

g++ --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: x86_64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I even tried compiling a simple C++ program with C++17 features with g++ -std=c++17 test.cpp and it works.

System: MacOS montery 12.4