Xcode 15.x ld_classic linker workaround
Whether using Clang / LLVM or Homebrew GNU GCC compiler, GNU ld is not supported on macOS.
Only the Apple macOS
Xcode ld is supported.
The new
ld linker
in Xcode 15 broke numerous projects, including OpenMPI < 4.1.6.
A special workaround for Xcode 15.x only is the linker flag -ld_classic, which is
deprecated in Xcode 16
and
removed in Xcode 27.
Set in file “~/.zshrc”
export LDFLAGS="$LDFLAGS -Wl,-ld_classic"Note that for CMake, LDFLAGS environment variable is read only on the first CMake configure and cached.