Install on mac os fails - The C++ compiler cannot find a working standard library and it is not li

GROMACS version: gromacs-2022.4
GROMACS modification: No

I am following the quick and dirty install guidelines at https://manual.gromacs.org/documentation/current/install-guide/index.html.

cmake is failing, see below. I also tried with different combinations of -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER set to clang/clang++.

I don’t really understand how to resolve the error The C++ compiler cannot find a working standard library and it is not libstdc++.

(base) gws-MacBook-Pro-6:build gw$ cmake ..  -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc -DGMX_GPLUSPLUS_PATH=g++ -DCMAKE_CXX_COMPILER=g++
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CXX17_COMPILES
-- Performing Test CXX17_COMPILES - Failed
-- Performing Test USING_LIBSTDCXX
-- Performing Test USING_LIBSTDCXX - Failed
CMake Error at cmake/FindLibStdCpp.cmake:81 (message):
  The C++ compiler cannot find a working standard library and it is not
  libstdc++.  The GROMACS build cannot handle this case.  Please use a
  working C++17 compiler and standard library.
Call Stack (most recent call first):
  CMakeLists.txt:68 (find_package)


-- Configuring incomplete, errors occurred!
See also "/Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeOutput.log".
See also "/Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeError.log".
(base) gws-MacBook-Pro-6:build gw$ cat /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeOutput.log
The system is: Darwin - 17.7.0 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/gcc
Build flags:
Id flags:

The output was:
0


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"

The C compiler identification is AppleClang, found in "/Users/gw/software/gromacs-2022.4/build/CMakeFiles/3.24.20220817-gb6cfa38/CompilerIdC/a.out"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler: /usr/bin/g++
Build flags:
Id flags:

The output was:
0


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out"

The CXX compiler identification is AppleClang, found in "/Users/gw/software/gromacs-2022.4/build/CMakeFiles/3.24.20220817-gb6cfa38/CompilerIdCXX/a.out"

Detecting C compiler ABI info compiled with the following output:
Change Dir: /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_8bedd/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_8bedd.dir/build.make CMakeFiles/cmTC_8bedd.dir/build
Building C object CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o
/usr/bin/gcc   -v -Wl,-v -MD -MT CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -MF CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o.d -o CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -c /usr/local/share/cmake-3.24/Modules/CMakeCCompilerABI.c
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Found CUDA installation: /usr/local/cuda, version unknown
clang: warning: -Wl,-v: 'linker' input unused [-Wunused-command-line-argument]
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 409.12 -v -coverage-notes-file /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.gcno -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0 -dependency-file CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o.d -skip-unused-modulemap-deps -sys-header-deps -MT CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -fdebug-compilation-dir /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fencode-extended-block-signature -fobjc-runtime=macosx-10.13.0 -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -x c /usr/local/share/cmake-3.24/Modules/CMakeCCompilerABI.c
clang -cc1 version 10.0.0 (clang-1000.11.45.5) default target x86_64-apple-darwin17.7.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
Linking C executable cmTC_8bedd
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8bedd.dir/link.txt --verbose=1
/usr/bin/gcc -Wl,-search_paths_first -Wl,-headerpad_max_install_names  -v -Wl,-v CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -o cmTC_8bedd
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Found CUDA installation: /usr/local/cuda, version unknown
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.13.0 -o cmTC_8bedd -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld  PROJECT:ld64-409.12
BUILD 17:47:51 Sep 25 2018
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em arm64e arm64_32
Library search paths:
	/usr/lib
	/usr/local/lib
Framework search paths:
	/Library/Frameworks/
	/System/Library/Frameworks/



Parsed C implicit include dir info from above output: rv=done
  found start of include info
  found start of implicit include info
    add: [/usr/local/include]
    add: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include]
    add: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include]
    add: [/usr/include]
  end of search list found
  collapse include dir [/usr/local/include] ==> [/usr/local/include]
  collapse include dir [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include] ==> [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include]
  collapse include dir [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include] ==> [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include]
  collapse include dir [/usr/include] ==> [/usr/include]
  implicit include dirs: [/usr/local/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include]


Parsed C implicit link information from above output:
  link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
  ignore line: [Change Dir: /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp]
  ignore line: []
  ignore line: [Run Build Command(s):/usr/bin/make -f Makefile cmTC_8bedd/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_8bedd.dir/build.make CMakeFiles/cmTC_8bedd.dir/build]
  ignore line: [Building C object CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o]
  ignore line: [/usr/bin/gcc   -v -Wl -v -MD -MT CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -MF CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o.d -o CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -c /usr/local/share/cmake-3.24/Modules/CMakeCCompilerABI.c]
  ignore line: [Apple LLVM version 10.0.0 (clang-1000.11.45.5)]
  ignore line: [Target: x86_64-apple-darwin17.7.0]
  ignore line: [Thread model: posix]
  ignore line: [InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin]
  ignore line: [Found CUDA installation: /usr/local/cuda  version unknown]
  ignore line: [clang: warning: -Wl -v: 'linker' input unused [-Wunused-command-line-argument]]
  ignore line: [ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCCompilerABI.c -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 409.12 -v -coverage-notes-file /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.gcno -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0 -dependency-file CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o.d -skip-unused-modulemap-deps -sys-header-deps -MT CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -fdebug-compilation-dir /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fencode-extended-block-signature -fobjc-runtime=macosx-10.13.0 -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -x c /usr/local/share/cmake-3.24/Modules/CMakeCCompilerABI.c]
  ignore line: [clang -cc1 version 10.0.0 (clang-1000.11.45.5) default target x86_64-apple-darwin17.7.0]
  ignore line: [#include "..." search starts here:]
  ignore line: [#include <...> search starts here:]
  ignore line: [ /usr/local/include]
  ignore line: [ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include]
  ignore line: [ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include]
  ignore line: [ /usr/include]
  ignore line: [ /System/Library/Frameworks (framework directory)]
  ignore line: [ /Library/Frameworks (framework directory)]
  ignore line: [End of search list.]
  ignore line: [Linking C executable cmTC_8bedd]
  ignore line: [/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8bedd.dir/link.txt --verbose=1]
  ignore line: [/usr/bin/gcc -Wl -search_paths_first -Wl -headerpad_max_install_names  -v -Wl -v CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -o cmTC_8bedd ]
  ignore line: [Apple LLVM version 10.0.0 (clang-1000.11.45.5)]
  ignore line: [Target: x86_64-apple-darwin17.7.0]
  ignore line: [Thread model: posix]
  ignore line: [InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin]
  ignore line: [Found CUDA installation: /usr/local/cuda  version unknown]
  link line: [ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.13.0 -o cmTC_8bedd -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a]
    arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld] ==> ignore
    arg [-demangle] ==> ignore
    arg [-lto_library] ==> ignore, skip following value
    arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib] ==> skip value of -lto_library
    arg [-dynamic] ==> ignore
    arg [-arch] ==> ignore
    arg [x86_64] ==> ignore
    arg [-macosx_version_min] ==> ignore
    arg [10.13.0] ==> ignore
    arg [-o] ==> ignore
    arg [cmTC_8bedd] ==> ignore
    arg [-search_paths_first] ==> ignore
    arg [-headerpad_max_install_names] ==> ignore
    arg [-v] ==> ignore
    arg [CMakeFiles/cmTC_8bedd.dir/CMakeCCompilerABI.c.o] ==> ignore
    arg [-lSystem] ==> lib [System]
    arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a] ==> lib [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a]
  Library search paths: [;/usr/lib;/usr/local/lib]
  Framework search paths: [;/Library/Frameworks/;/System/Library/Frameworks/]
  remove lib [System]
  remove lib [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a]
  collapse library dir [/usr/lib] ==> [/usr/lib]
  collapse library dir [/usr/local/lib] ==> [/usr/local/lib]
  collapse framework dir [/Library/Frameworks/] ==> [/Library/Frameworks]
  collapse framework dir [/System/Library/Frameworks/] ==> [/System/Library/Frameworks]
  implicit libs: []
  implicit objs: []
  implicit dirs: [/usr/lib;/usr/local/lib]
  implicit fwks: [/Library/Frameworks;/System/Library/Frameworks]


Detecting CXX compiler ABI info compiled with the following output:
Change Dir: /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_d31dc/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_d31dc.dir/build.make CMakeFiles/cmTC_d31dc.dir/build
Building CXX object CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o
/usr/bin/g++   -v -Wl,-v -MD -MT CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -MF CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o.d -o CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/share/cmake-3.24/Modules/CMakeCXXCompilerABI.cpp
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Found CUDA installation: /usr/local/cuda, version unknown
clang: warning: -Wl,-v: 'linker' input unused [-Wunused-command-line-argument]
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 409.12 -v -coverage-notes-file /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.gcno -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0 -dependency-file CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o.d -skip-unused-modulemap-deps -sys-header-deps -MT CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fencode-extended-block-signature -fobjc-runtime=macosx-10.13.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -x c++ /usr/local/share/cmake-3.24/Modules/CMakeCXXCompilerABI.cpp
clang -cc1 version 10.0.0 (clang-1000.11.45.5) default target x86_64-apple-darwin17.7.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
 /usr/local/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include
 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.
Linking CXX executable cmTC_d31dc
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d31dc.dir/link.txt --verbose=1
/usr/bin/g++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names  -v -Wl,-v CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_d31dc
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Found CUDA installation: /usr/local/cuda, version unknown
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.13.0 -o cmTC_d31dc -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a
@(#)PROGRAM:ld  PROJECT:ld64-409.12
BUILD 17:47:51 Sep 25 2018
configured to support archs: armv6 armv7 armv7s arm64 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em arm64e arm64_32
Library search paths:
	/usr/lib
	/usr/local/lib
Framework search paths:
	/Library/Frameworks/
	/System/Library/Frameworks/



Parsed CXX implicit include dir info from above output: rv=done
  found start of include info
  found start of implicit include info
    add: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1]
    add: [/usr/local/include]
    add: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include]
    add: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include]
    add: [/usr/include]
  end of search list found
  collapse include dir [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1] ==> [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1]
  collapse include dir [/usr/local/include] ==> [/usr/local/include]
  collapse include dir [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include] ==> [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include]
  collapse include dir [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include] ==> [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include]
  collapse include dir [/usr/include] ==> [/usr/include]
  implicit include dirs: [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1;/usr/local/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include;/usr/include]


Parsed CXX implicit link information from above output:
  link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)]
  ignore line: [Change Dir: /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp]
  ignore line: []
  ignore line: [Run Build Command(s):/usr/bin/make -f Makefile cmTC_d31dc/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_d31dc.dir/build.make CMakeFiles/cmTC_d31dc.dir/build]
  ignore line: [Building CXX object CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o]
  ignore line: [/usr/bin/g++   -v -Wl -v -MD -MT CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -MF CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o.d -o CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -c /usr/local/share/cmake-3.24/Modules/CMakeCXXCompilerABI.cpp]
  ignore line: [Apple LLVM version 10.0.0 (clang-1000.11.45.5)]
  ignore line: [Target: x86_64-apple-darwin17.7.0]
  ignore line: [Thread model: posix]
  ignore line: [InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin]
  ignore line: [Found CUDA installation: /usr/local/cuda  version unknown]
  ignore line: [clang: warning: -Wl -v: 'linker' input unused [-Wunused-command-line-argument]]
  ignore line: [ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.13.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name CMakeCXXCompilerABI.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 409.12 -v -coverage-notes-file /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp/CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.gcno -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0 -dependency-file CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o.d -skip-unused-modulemap-deps -sys-header-deps -MT CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fencode-extended-block-signature -fobjc-runtime=macosx-10.13.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -x c++ /usr/local/share/cmake-3.24/Modules/CMakeCXXCompilerABI.cpp]
  ignore line: [clang -cc1 version 10.0.0 (clang-1000.11.45.5) default target x86_64-apple-darwin17.7.0]
  ignore line: [ignoring nonexistent directory "/usr/include/c++/v1"]
  ignore line: [#include "..." search starts here:]
  ignore line: [#include <...> search starts here:]
  ignore line: [ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1]
  ignore line: [ /usr/local/include]
  ignore line: [ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include]
  ignore line: [ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include]
  ignore line: [ /usr/include]
  ignore line: [ /System/Library/Frameworks (framework directory)]
  ignore line: [ /Library/Frameworks (framework directory)]
  ignore line: [End of search list.]
  ignore line: [Linking CXX executable cmTC_d31dc]
  ignore line: [/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d31dc.dir/link.txt --verbose=1]
  ignore line: [/usr/bin/g++ -Wl -search_paths_first -Wl -headerpad_max_install_names  -v -Wl -v CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_d31dc ]
  ignore line: [Apple LLVM version 10.0.0 (clang-1000.11.45.5)]
  ignore line: [Target: x86_64-apple-darwin17.7.0]
  ignore line: [Thread model: posix]
  ignore line: [InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin]
  ignore line: [Found CUDA installation: /usr/local/cuda  version unknown]
  link line: [ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.13.0 -o cmTC_d31dc -search_paths_first -headerpad_max_install_names -v CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a]
    arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld] ==> ignore
    arg [-demangle] ==> ignore
    arg [-lto_library] ==> ignore, skip following value
    arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib] ==> skip value of -lto_library
    arg [-dynamic] ==> ignore
    arg [-arch] ==> ignore
    arg [x86_64] ==> ignore
    arg [-macosx_version_min] ==> ignore
    arg [10.13.0] ==> ignore
    arg [-o] ==> ignore
    arg [cmTC_d31dc] ==> ignore
    arg [-search_paths_first] ==> ignore
    arg [-headerpad_max_install_names] ==> ignore
    arg [-v] ==> ignore
    arg [CMakeFiles/cmTC_d31dc.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore
    arg [-lc++] ==> lib [c++]
    arg [-lSystem] ==> lib [System]
    arg [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a] ==> lib [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a]
  Library search paths: [;/usr/lib;/usr/local/lib]
  Framework search paths: [;/Library/Frameworks/;/System/Library/Frameworks/]
  remove lib [System]
  remove lib [/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/lib/darwin/libclang_rt.osx.a]
  collapse library dir [/usr/lib] ==> [/usr/lib]
  collapse library dir [/usr/local/lib] ==> [/usr/local/lib]
  collapse framework dir [/Library/Frameworks/] ==> [/Library/Frameworks]
  collapse framework dir [/System/Library/Frameworks/] ==> [/System/Library/Frameworks]
  implicit libs: [c++]
  implicit objs: []
  implicit dirs: [/usr/lib;/usr/local/lib]
  implicit fwks: [/Library/Frameworks;/System/Library/Frameworks]


(base) gws-MacBook-Pro-6:build gw$ cat /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeError.log
Performing C++ SOURCE FILE Test CXX17_COMPILES failed with the following output:
Change Dir: /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_b3567/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_b3567.dir/build.make CMakeFiles/cmTC_b3567.dir/build
Building CXX object CMakeFiles/cmTC_b3567.dir/src.cxx.o
/usr/bin/g++ -DCXX17_COMPILES  -std=c++17 -MD -MT CMakeFiles/cmTC_b3567.dir/src.cxx.o -MF CMakeFiles/cmTC_b3567.dir/src.cxx.o.d -o CMakeFiles/cmTC_b3567.dir/src.cxx.o -c /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp/src.cxx
/Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp/src.cxx:7:31: error: call to unavailable member function 'value': introduced in macOS 10.14
  std::string_view view(input.value());
                        ~~~~~~^~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/optional:942:27: note: candidate function has been explicitly made unavailable
    constexpr value_type& value() &
                          ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/optional:933:33: note: candidate function has been explicitly made unavailable
    constexpr value_type const& value() const&
                                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/optional:951:28: note: candidate function not viable: no known conversion from 'optional<...>' to 'optional<...>' for object argument
    constexpr value_type&& value() &&
                           ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/optional:960:34: note: candidate function not viable: no known conversion from 'optional<...>' to 'const optional<...>' for object argument
    constexpr value_type const&& value() const&&
                                 ^
1 error generated.
make[1]: *** [CMakeFiles/cmTC_b3567.dir/src.cxx.o] Error 1
make: *** [cmTC_b3567/fast] Error 2


Source file was:

#include <string>
#include <string_view>
#include <optional>
int main(int argc, char **argv) {
  std::optional<std::string> input(argv[0]);
  std::string_view view(input.value());
  return int(view[0]);
}
Performing C++ SOURCE FILE Test USING_LIBSTDCXX failed with the following output:
Change Dir: /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_b1afa/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_b1afa.dir/build.make CMakeFiles/cmTC_b1afa.dir/build
Building CXX object CMakeFiles/cmTC_b1afa.dir/src.cxx.o
/usr/bin/g++ -DUSING_LIBSTDCXX  -std=c++17 -MD -MT CMakeFiles/cmTC_b1afa.dir/src.cxx.o -MF CMakeFiles/cmTC_b1afa.dir/src.cxx.o.d -o CMakeFiles/cmTC_b1afa.dir/src.cxx.o -c /Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp/src.cxx
/Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeTmp/src.cxx:2:21: error: use of undeclared identifier '__GLIBCXX__'
int main() { return __GLIBCXX__; }
                    ^
1 error generated.
make[1]: *** [CMakeFiles/cmTC_b1afa.dir/src.cxx.o] Error 1
make: *** [cmTC_b1afa/fast] Error 2


Source file was:
#include <new>
int main() { return __GLIBCXX__; }
(base) gws-MacBook-Pro-6:build gw$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


(base) gws-MacBook-Pro-6:build gw$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


(base) gws-MacBook-Pro-6:build gw$ clang --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin


(base) gws-MacBook-Pro-6:build gw$ clang++ --version
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Hello,

Can you please try compiling with the libc++ from clang instead? It looks like whatever MacOS is providing as g++ doesn’t work :)

As a note, I’ve been compiling this version of GROMACS on my Mac for months now without issue, so I hope this is just the default Mac clang being confused.

Cheers

Paul

How exactly do I do that? I googled “libc++ from apple clang” and read 5 links, but couldn’t figure it out.

  1. How do I find the path for the libc++ from clang?
  2. Once I have that path do I use it with the flag -DCMAKE_CXX_FLAGS ?

Using the flags -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_CXX_FLAGS=-stdlib=libc++ isn’t working

(base) gws-MacBook-Pro-6:build gw$ cmake ..  -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=-stdlib=libc++
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CXX17_COMPILES
-- Performing Test CXX17_COMPILES - Failed
-- Performing Test USING_LIBSTDCXX
-- Performing Test USING_LIBSTDCXX - Failed
CMake Error at cmake/FindLibStdCpp.cmake:81 (message):
  The C++ compiler cannot find a working standard library and it is not
  libstdc++.  The GROMACS build cannot handle this case.  Please use a
  working C++17 compiler and standard library.
Call Stack (most recent call first):
  CMakeLists.txt:68 (find_package)


-- Configuring incomplete, errors occurred!
See also "/Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeOutput.log".
See also "/Users/gw/software/gromacs-2022.4/build/CMakeFiles/CMakeError.log".

Also, if it helps

(base) gws-MacBook-Pro-6:developer gw$ clang++ test.cpp -o test.out -stdlib=libc++ # works fine
(base) gws-MacBook-Pro-6:developer gw$ clang++ test.cpp -o test.out -stdlib=libstdc++
clang: warning: libstdc++ is deprecated; move to libc++ [-Wdeprecated]

Hello,

you should just need to add -stdlib=libc++ to -DCMAKE_CXX_FLAGS, but
there must be a deeper issue with your compiler setup.

I just tried building release-2022.4 the same way as you did initially
and didn’t have any issues. But I’m using Homebrew on the Mac, so that
might affect things.

Cheers

Paul

So any suggestions for trouble shooting the error message I’m getting with adding -stdlib=libc++ to -DCMAKE_CXX_FLAGS ?