Xcode new linker workaround
Whether using Clang/LLVM or Homebrew GNU compiler, GNU ld is not supported on macOS, only the Apple macOS Xcode ld is supported. The new ld linker in Xcode 15 breaks numerous projects, including OpenMPI < 4.1.6. The workaround is to use the classic linker, which is still supported in Xcode 15.
Set in ~/.zshrc
export LDFLAGS="$LDFLAGS -Wl,-ld_classic"
or specify on the program command line like:
LDFLAGS="$LDFLAGS -Wl,-ld_classic" make
Note that for CMake, LDFLAGS environment variable is read only on the first CMake configure and cached.