CMake suddenly stopped working macOS Sonoma

I recently updated my XCode Command Line Tools. After that, I started getting the following error when running cmake

% cmake
dyld[97959]: weak-def symbol not found '__ZnwmSt19__type_descriptor_t’weak-def symbol not found > ‘__ZnamSt19__type_descriptor_t’
zsh: abort cmake

I have tried downgrading my current version of the XCode Command Line Tools as well as re-installing different versions of CMake to no avail. Any help would be most appreciated.

This is only a problem with CMake which is build from source by me and not with the CMake installed from the binary.

It looks like you built CMake with build_shared_libs=on. I think you need to rebuild CMake from scratch since the dynamic libraries generally change when you change xcode versions.

Do you know how I could build it without the shared libraries? Where can I specify the flag?

./configure --prefix=prefix --build_with_shared_libs=on?

This might be inevitable even if using static linking for CMake, as things like system libc++ can still be dynamically linked. The same error is noticed by others when upgrading Xcode.

I think the “bootstrap” builds CMake with vendored static libraries by default–except libc++. So I think the solution is to just rebuild CMake as you did before (e.g. with “bootstrap”).