# cmake not working after update do Big Sur

**URL:** https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546
**Category:** Usage
**Tags:** os:macos
**Created:** [January 14, 2021, 4:51pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546 "2021-01-14T16:51:23Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Harniver](https://discourse.cmake.org/user_avatar/discourse.cmake.org/harniver/32/1107_2.png) [@Harniver](https://discourse.cmake.org/u/Harniver)
#### Post date: [January 14, 2021, 4:51pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/1 "2021-01-14T16:51:23Z")

</div>

After updating to Big Sur, I am unable to compile anything with cmake. I re-installed the command line tools (`xcode-select --install`) and updated cmake (`brew upgrade cmake`). When running `cmake -S ./ -B ./bin -G "Unix Makefiles"` i get the output:

```
-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang - broken
CMake Error at /usr/local/Cellar/cmake/3.19.3/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler
    "/usr/bin/clang"
  is not able to compile a simple test program.
  It fails with the following output:
    /usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -o CMakeFiles/cmTC_b5a37.dir/testCCompiler.c.o -c /Users/harniver/Git/aggregate/fcpp/fcpp/bin/CMakeFiles/CMakeTmp/testCCompiler.c
    /usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -static CMakeFiles/cmTC_b5a37.dir/testCCompiler.c.o -o cmTC_b5a37
    ld: library not found for -lcrt0.o
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

```

In other projects I get similar error except that the missing library is something else (`-lSystem`, for example). Any ideas on what may be going wrong?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 14, 2021, 7:37pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/2 "2021-01-14T19:37:46Z")

</div>

@brad.king

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [January 14, 2021, 9:26pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/3 "2021-01-14T21:26:08Z")

</div>

Have you started up the Xcode IDE since you installed it? There may be missing components or a license may need to be accepted. Both of these seem unlikely though.

Also, have a look at the `CMakeFiles/CMakeError.log` and `CMakeFiles/CMakeOutput.log` files in your build directory and see if there are any clues in there for what might be going on.

---

<div class="post-metadata">

### Author: ![Harniver](https://discourse.cmake.org/user_avatar/discourse.cmake.org/harniver/32/1107_2.png) [@Harniver](https://discourse.cmake.org/u/Harniver)
#### Post date: [January 14, 2021, 10:28pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/4 "2021-01-14T22:28:40Z")

</div>

Yes, I have used the Xcode IDE (and to be sure I just used it again and re-tried with no difference). The CMakeError/CMakeOutput files are very big and it’s hard for me to make any sense from them. I can see that in CMakeError there are several occurrences of these:

```
ld: library not found for -lSystem
ld: library not found for -lc++

```

Do you have suggestion on some things to look for in those files?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [January 22, 2021, 4:29am UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/5 "2021-01-22T04:29:17Z")

</div>

Another thought, have you tried the official CMake package from [cmake.org/download](http://cmake.org/download)? It would be good to rule out a problem caused by how brew builds/provides CMake.

Where you see those “library not found” errors in the `CMakeError.log` file, what’s the command line just before it that causes those errors?

What version of Xcode are you using? If it isn’t the latest, please try the latest to confirm whether you still see the issue.

Do you get the same error if you try to use the Xcode generator instead of `Unix Makefiles`? A useful side effect of using the Xcode generator is that the `try_compile()` run used during compiler checks creates a temporary Xcode project that you can open up in the Xcode IDE and look for any suspicious settings.

Does your project have anything other than a call to `cmake_minimum_required()` before the first `project()` call?

---

<div class="post-metadata">

### Author: ![Harniver](https://discourse.cmake.org/user_avatar/discourse.cmake.org/harniver/32/1107_2.png) [@Harniver](https://discourse.cmake.org/u/Harniver)
#### Post date: [January 22, 2021, 9:24am UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/6 "2021-01-22T09:24:34Z")

</div>

I just tried again to build the library and the problem seems to have fixed itself (not clear exactly what happened). Thanks anyway for the help!

---

<div class="post-metadata">

### Author: ![kamyar](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kamyar/32/1344_2.png) [@kamyar](https://discourse.cmake.org/u/kamyar)
#### Post date: [April 29, 2021, 2:35am UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/7 "2021-04-29T02:35:06Z")

</div>

I also have the same issue on an Intel MBP running Big Sur. I tried EVERYTHING™, even format and clean reinstall of Bug Sur 11.3, homebrew (installing cmake 3.20.1), and the full Xcode and 12.5 (also tried command line tools).

```
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc 
Build flags: 
Id flags:  

The output was:
1
ld: library not found for -lSystem
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ 
Build flags: 
Id flags:  

The output was:
1
ld: library not found for -lc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```

Any feedback is highly appreciated!

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [April 29, 2021, 10:01am UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/8 "2021-04-29T10:01:07Z")

</div>

Try using the [official CMake release](https://github.com/Kitware/CMake/releases) rather than the one from homebrew. That should help narrow down whether your issue is homebrew-related or something else.

---

<div class="post-metadata">

### Author: ![gpp](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/848f3c/32.png) [@gpp](https://discourse.cmake.org/u/gpp)
#### Post date: [September 6, 2021, 6:18pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/10 "2021-09-06T18:18:55Z")

</div>

Has anyone solved this yet? I’m on Big Sur 11.5.2, Xcode 12.5.1. Have tried with CMake 3.18.6 and 3.21.2. I get the same output as Kamyar’s post of Apr 28. It only happens when my generator is “Unix Makefiles”. I was able to get another project built with CMake on Big Sur whose generator was “Xcode”.

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 6, 2021, 9:05pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/11 "2021-09-06T21:05:48Z")

</div>

Same advice as above: are you using CMake provided by homebrew or the official release from Kitware? If you’re using the one from homebrew, try the official release instead. If that fixes your problem, please report back here.

---

<div class="post-metadata">

### Author: ![Jason\_Thomas](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jason_thomas/32/1916_2.png) [@Jason\_Thomas](https://discourse.cmake.org/u/Jason_Thomas)
#### Post date: [October 28, 2021, 10:34pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/12 "2021-10-28T22:34:26Z")

</div>

I get the same error using both homebrew, and the official CMake release.

Using cmake downloaded from [https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-macos-universal.dmg](https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-macos-universal.dmg)

```auto
❯ /Applications/CMake.app/Contents/bin/cmake .
CMake Warning at /Applications/CMake.app/Contents/share/cmake-3.22/Modules/Platform/Darwin-Initialize.cmake:303 (message):
  Ignoring CMAKE_OSX_SYSROOT value:

   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk

  because the directory does not exist.
Call Stack (most recent call first):
  /Applications/CMake.app/Contents/share/cmake-3.22/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
  CMakeLists.txt:2 (project)

-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/jthomas/git-projects/coscreen-screen-capturer/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/make -f Makefile cmTC_6006a/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_6006a.dir/build.make CMakeFiles/cmTC_6006a.dir/build
    Building CXX object CMakeFiles/cmTC_6006a.dir/testCXXCompiler.cxx.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -arch x86_64 -mmacosx-version-min=11.5 -MD -MT CMakeFiles/cmTC_6006a.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_6006a.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_6006a.dir/testCXXCompiler.cxx.o -c /Users/jthomas/git-projects/coscreen-screen-capturer/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Linking CXX executable cmTC_6006a
    /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6006a.dir/link.txt --verbose=1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -arch x86_64 -mmacosx-version-min=11.5 -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_6006a.dir/testCXXCompiler.cxx.o -o cmTC_6006a
    ld: library not found for -lc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[1]: *** [cmTC_6006a] Error 1
    make: *** [cmTC_6006a/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!

```

I think it’s some incompatibility with the new MacOSX SDK/toolchain?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [October 28, 2021, 11:06pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/13 "2021-10-28T23:06:26Z")

</div>

The SDK directory not existing certainly sounds important. Did Xcode get updated and bring in a new SDK version (maybe 11.4?). I think there’s an unversioned symlink (`MacOSX.sdk`); you may have better post-update luck with using that name.

---

<div class="post-metadata">

### Author: ![Jason\_Thomas](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jason_thomas/32/1916_2.png) [@Jason\_Thomas](https://discourse.cmake.org/u/Jason_Thomas)
#### Post date: [October 28, 2021, 11:18pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/14 "2021-10-28T23:18:38Z")

</div>

@ben.boeckel

Yeah, that’s exactly what’s happening.

Updating XCode blows away your

```auto
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs 

```

directory and makes a single directory containing only MacOSX12.0.sdk pointing at MacOSX.sdk.

This seems to suffer from a lack of libc++.dylib being present… Maybe due to something having to do with how Big Sur loads libraries (not sure if I understand it)?

[https://developer.apple.com/forums/thread/666700](https://developer.apple.com/forums/thread/666700)

The following steps resolved it for me:

```auto
# cd `xcode-select -p`/
# cd Platforms/MacOSX.platform/Developer/SDKs/
# git clone https://github.com/phracker/MacOSX-SDKs.git
# cp -r MacOSX-SDKs/MacOSX11.3.sdk .

```

And then I made sure CMAKE\_OSX\_SYSROOT was pointing at:

```auto
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk

```

---

<div class="post-metadata">

### Author: ![Huang\_Xiaozheng](https://discourse.cmake.org/user_avatar/discourse.cmake.org/huang_xiaozheng/32/1917_2.png) [@Huang\_Xiaozheng](https://discourse.cmake.org/u/Huang_Xiaozheng)
#### Post date: [October 29, 2021, 6:01am UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/15 "2021-10-29T06:01:44Z")

</div>

not working for me, got confused.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [October 29, 2021, 12:19pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/16 "2021-10-29T12:19:09Z")

</div>

> [@Jason\_Thomas](#):
>
> This seems to suffer from a lack of libc++.dylib being present… Maybe due to something having to do with how Big Sur loads libraries (not sure if I understand it)?

Yeah, the system libraries themselves now live off in some system-wide library cache. The `.tbd` files have the information the linker needs to figure out what to do.

Note that the way Apple works, you should be able to use any new-enough SDK and use `-mmacosx-min-version=` to restrict API usage of anything newer than that version. See `CMAKE_OSX_DEPLOYMENT_TARGET` for the CMake knob to handle that (you want `=11.3` here).

---

<div class="post-metadata">

### Author: ![nega](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nega](https://discourse.cmake.org/u/nega)
#### Post date: [October 29, 2021, 7:25pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/17 "2021-10-29T19:25:48Z")

</div>

As an FYI, I just ran into this myself. Specifically the compiler test failed with:

`ld: library not found for -lSystem`

Running the following fixed things for me. I don’t need anything but the default SDKs.

```auto
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install

```

---

<div class="post-metadata">

### Author: ![BJWiley233](https://discourse.cmake.org/user_avatar/discourse.cmake.org/bjwiley233/32/2017_2.png) [@BJWiley233](https://discourse.cmake.org/u/BJWiley233)
#### Post date: [December 9, 2021, 7:17am UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/18 "2021-12-09T07:17:59Z")

</div>

FYI if you get here from trying to compile with Intel.  
[https://community.intel.com/t5/Intel-C-Compiler/How-to-use-the-Intel-Classic-C-Compiler-with-macOS-11-Big-Sur/m-p/1295419](https://community.intel.com/t5/Intel-C-Compiler/How-to-use-the-Intel-Classic-C-Compiler-with-macOS-11-Big-Sur/m-p/1295419)

---

<div class="post-metadata">

### Author: ![naweld](https://discourse.cmake.org/user_avatar/discourse.cmake.org/naweld/32/2194_2.png) [@naweld](https://discourse.cmake.org/u/naweld)
#### Post date: [February 18, 2022, 10:07pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/19 "2022-02-18T22:07:45Z")

</div>

In case someone is still struggling with this, I fixed it by updating my SDKROOT variable

export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)

---

<div class="post-metadata">

### Author: ![andy55](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/7993a0/32.png) [@andy55](https://discourse.cmake.org/u/andy55)
#### Post date: [March 19, 2022, 3:29pm UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/20 "2022-03-19T15:29:09Z")

</div>

This!

Though was seeing it through in the form: `ld: library not found for -lSystem`

Thanks for the workaround fellas, that saved me after already blowing away half my day on this on red herrings and thinking it was a paths issue.

It seems like this is a rising issue since as the upgraded MacOSX12 sdk does not contain what’s needed the 11.3 sdk must be used – an earlier post in this thread also confirms this. On other words, what happens when that 11.3 sdk is no longer available (or if we don’t want link to against a rando github SDK provider).

---

<div class="post-metadata">

### Author: ![tjayrush](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tjayrush/32/1410_2.png) [@tjayrush](https://discourse.cmake.org/u/tjayrush)
#### Post date: [March 4, 2023, 1:36am UTC](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546/21 "2023-03-04T01:36:22Z")

</div>

Not sure if this is helpful, but it makes a bit of sense to me.

What I did to solve this is clean my build folder of existing builds. I deleted all the contents of my build folder (be careful if you do this and do not blame me if it removes something you care about).

As soon as I did this, `cmake ../src` worked directly.

I could have (but did not) try: `make clean` first.

[Next page](https://discourse.cmake.org/t/cmake-not-working-after-update-do-big-sur/2546.md?page=2)
