# cmake issue with clang-scan-deps and macosx

**URL:** <https://discourse.cmake.org/t/cmake-issue-with-clang-scan-deps-and-macosx/15322>\
**Category:** Code\
**Created:** [November 18, 2025, 4:24pm UTC](https://discourse.cmake.org/t/cmake-issue-with-clang-scan-deps-and-macosx/15322 "2025-11-18T16:24:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vbl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vbl/32/5905_2.png) [@vbl](https://discourse.cmake.org/u/vbl)\
**Post date:** [November 18, 2025, 4:24pm UTC](https://discourse.cmake.org/t/cmake-issue-with-clang-scan-deps-and-macosx/15322/1 "2025-11-18T16:24:53Z")

</div>

Hello,

cmake version 3.31.7  
clang version 21.1.5  
ninja version 1.13.1

Trying to cmake the following simple C++ coding and the following CMakeLists.txt with my macosx ..

#include  
#include \<memory\_resource\>  
#include  
#include

int main() {

```auto
std::pmr::unsynchronized_pool_resource pool3({
    .max_blocks_per_chunk = 64,
    .largest_required_pool_block = 512,
});

std::pmr::list<std::pmr::string> list6(&pool3);
list6.emplace_back("this string is long enough");

for (auto& l : list6)
  std::cout << l << '\n' ;

return 0;

```

}

$ cat CMakeLists.txt

cmake\_minimum\_required(VERSION 3.31)  
set(CMAKE\_C\_COMPILER /opt/local/bin/clang CACHE STRING “C compiler” FORCE)  
set(CMAKE\_CXX\_COMPILER /opt/local/bin/clang++ CACHE STRING “C++ compiler” FORCE)  
set(CMAKE\_CXX\_COMPILER\_LINKER /opt/local/libexec/llvm-21/bin/lld)  
set(CMAKE\_CXX\_COMPILER\_CLANG\_SCAN\_DEPS /opt/local/libexec/llvm-21/bin/clang-scan-deps)  
project(test-macosx VERSION 0.0.0.1 LANGUAGES C CXX)  
set(CMAKE\_CXX\_STANDARD 23)  
set(CMAKE\_CXX\_STANDARD\_REQUIRED ON)  
set(CMAKE\_CXX\_EXTENSIONS ON)  
set(CMAKE\_EXPORT\_COMPILE\_COMMANDS ON)  
set(CMAKE\_EXE\_LINKER\_FLAGS “-L/opt/local/libexec/llvm-21/lib/libc++ -L/opt/local/libexec/llvm-21/lib/libunwind -lc++ -lc++abi -Wl,-rpath /opt/local/libexec/llvm-21/lib/libc++ -Wl,-rpath /opt/local/libexec/llvm-21/lib/libunwind”)  
set(CMAKE\_PREFIX\_PATH /opt/local/libexec/llvm-21/lib/cmake/llvm)  
find\_package(LLVM REQUIRED CONFIG)  
add\_executable(a.out clang.cpp)  
target\_compile\_options(a.out PRIVATE -stdlib=libc++ -lc++abi -fexperimental-library)

With a basic (non scan-deps usage) cmake is behaving all ok ..

$ cmake -S . -B build ; cmake --build build

– The C compiler identification is Clang 21.1.5  
– The CXX compiler identification is Clang 21.1.5  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– Check for working C compiler: /opt/local/bin/clang - skipped  
– Detecting C compile features  
– Detecting C compile features - done  
– Detecting CXX compiler ABI info  
– Detecting CXX compiler ABI info - done  
– Check for working CXX compiler: /opt/local/bin/clang++ - skipped  
– Detecting CXX compile features  
– Detecting CXX compile features - done  
– Performing Test HAVE\_FFI\_CALL  
– Performing Test HAVE\_FFI\_CALL - Success  
– Found FFI: /opt/local/lib/libffi.dylib  
– Looking for histedit.h  
– Looking for histedit.h - found  
– Found LibEdit: /opt/local/include (found version “2.11”)  
– Found ZLIB: /opt/local/lib/libz.dylib (found version “1.3.1”)  
– Found zstd: /opt/local/lib/libzstd.dylib  
– Found LibXml2: /opt/local/lib/libxml2.dylib (found version “2.13.9”)  
– Configuring done (7.9s)  
– Generating done (0.0s)  
– Build files have been written to: /Users/vbl/Development/test/build  
[50%] Building CXX object CMakeFiles/a.out.dir/clang.cpp.o  
clang++: warning: -lc++abi: ‘linker’ input unused [-Wunused-command-line-argument]  
[100%] Linking CXX executable a.out  
[100%] Built target a.o@rpatht@rpath

$ otool -L a.out  
a.out:  
@rpath/libc++.1.dylib (compatibility version 1.@r@rpathath.0, current version 1.0.0)  
@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)  
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)

$ ./a.out  
this string is long enough

When doing the same thing including Ninja (with scan-deps usage) it is NOK with macosx … with Linux all is Ok

$ cmake -S . -G Ninja -B build ; cmake --build build

– The C compiler identification is Clang 21.1.5  
– The CXX compiler identification is Clang 21.1.5  
– Detecting C compiler ABI info  
– Detecting C compiler ABI info - done  
– Check for working C compiler: /opt/local/bin/clang - skipped  
– Detecting C compile features  
– Detecting C compile features - done  
– Detecting CXX compiler ABI info  
– Detecting CXX compiler ABI info - done  
– Check for working CXX compiler: /opt/local/bin/clang++ - skipped  
– Detecting CXX compile features  
– Detecting CXX compile features - done  
– Performing Test HAVE\_FFI\_CALL  
– Performing Test HAVE\_FFI\_CALL - Success  
– Found FFI: /opt/local/lib/libffi.dylib  
– Looking for histedit.h  
– Looking for histedit.h - found  
– Found LibEdit: /opt/local/include (found version “2.11”)  
– Found ZLIB: /opt/local/lib/libz.dylib (found version “1.3.1”)  
– Found zstd: /opt/local/lib/libzstd.dylib  
– Found LibXml2: /opt/local/lib/libxml2.dylib (found version “2.13.9”)  
– Configuring done (3.4s)  
– Generating done (0.0s)  
– Build files have been written to: /Users/vbl/Development/test/build  
[1/4] Scanning /Users/vbl/Development/test/clang.cpp for CXX dependencies  
FAILED: [code=1] CMakeFiles/a.out.dir/clang.cpp.o.ddi  
“/opt/local/libexec/llvm-21/bin/clang-scan-deps” -format=p1689 – /opt/local/bin/clang++ -std=gnu++23 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mmacosx-version-min=12.7 -stdlib=libc++ -lc++abi -fexperimental-library -x c++ /Users/vbl/Development/test/clang.cpp -c -o CMakeFiles/a.out.dir/clang.cpp.o -resource-dir “/opt/local/libexec/llvm-21/lib/clang/21” -MT CMakeFiles/a.out.dir/clang.cpp.o.ddi -MD -MF CMakeFiles/a.out.dir/clang.cpp.o.ddi.d \> CMakeFiles/a.out.dir/clang.cpp.o.ddi.tmp && mv CMakeFiles/a.out.dir/clang.cpp.o.ddi.tmp CMakeFiles/a.out.dir/clang.cpp.o.ddi  
warning: -lc++abi: ‘linker’ input unused  
Error while scanning dependencies for /Users/vbl/Development/test/clang.cpp:  
warning: -lc++abi: ‘linker’ input unused [-Wunused-command-line-argument]  
/Users/vbl/Development/test/clang.cpp:2:10: fatal error: ‘memory\_resource’ file not found  
ninja: build stopped: subcommand failed.

anything I missed somewhere ?? .. looks with adding scan-deps it is not behaving the same ?? .. and pointing to an older clang thing ..

thanks in advance with your help ..
