CMake c++ build stopped working after Xcode version 16.2

I recently upgraded to macOS 14.7.2, triggering an upgrade to Xcode 16.2 and its command line tools. My open source project builds and runs fine in Xcode. But when I tested the CMake build, it failed looking for standard c++ headers.

I asked on stackoverflow but no solutions so far.

Any thoughts here?

Answered by DTS Engineer in 822307022

The first step here is to confirm that your command-line tools are working in general. See Investigating Third-Party IDE Integration Problems. If they’re not, that’s something I can help you with. If they are, then this is something specific to CMake, which isn’t something I have any expertise in.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

The first step here is to confirm that your command-line tools are working in general. See Investigating Third-Party IDE Integration Problems. If they’re not, that’s something I can help you with. If they are, then this is something specific to CMake, which isn’t something I have any expertise in.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@DTS Engineer : thanks for looking at this. Unfortunately, after working through your article, I essentially confirmed what I said above: “My open source project builds and runs fine in Xcode. But when I tested the CMake build, it failed looking for standard c++ headers.” Specifically:

fatal error: 'iostream' file not found

It is troubling to me that the only change from the beginning of this week — when the cmake build was working — and now — was to install a “point” update to MacOS 14. It looks like that minor update managed to break a widely used open source tool.

But this is only is CMake, right? You can build a simple C++ program by running clang++ directly?

Presuming that, I don’t have a good answer for you. I’ve no direct experience with CMake. Usually I recommend that folks in your situation seek help via their tool’s support channel.

Before doing that, however, I have another quick test for you to run: If you create a new local user (in System Settings > Users & Groups) and log in as that user, do you have the same problem there?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

I return with an update. I had a reply to my stackoverflow question from user @MihaiChelaru. He saw what appears to be the exact same failure, at the exact same macOS upgrade.

In his research he found a solution: forcing a full reload of CTL with sudo rm -rf /Library/Developer/CommandLineTools. After doing that (and some other macOS stuff as described in the SO post) my CMake build was miraculously cured!

While my c++ project has definitely changed in the 20 days, it was still failing the same way when I tested it today before deleting CLT. But importantly (in my opinion) my installation of CMake is unchanged as is my project's build script (called CMakeLists.txt). So:

  • CMake build was working
  • I installed macOS 14.7.2 and Xcode 16.2
  • CMake build stopped working
  • I deleted my /Library/Developer/CommandLineTools, etc.
  • CMake build started working again

I am certainly not in charge of how Apple chooses to allocate its software maintenance resources. But it would be super simple to create a minimal test in an acceptance suite to build a CMake hello.c project. Or possibly, explicitly clearing a user's CLT folder before switching?

Having been in your shoes, I know these policy issues always seem simple from the outside. But as a long time Mac user, I felt duty-bound to make sure this information made it back to you.

CMake c++ build stopped working after Xcode version 16.2
 
 
Q