Skip to content

CMake 3.28 and C++20, error: CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND #22305

Closed

Description

@Boris-Rasin

EMSDK needs to include "clang-scan-deps" tool, as CMake 3.28 with C++20 and clang compiler always runs this tool.

This CMake produces the error, test.cpp could be empty:

cmake_minimum_required(VERSION 3.5...3.28)

project(test)

set(CMAKE_CXX_STANDARD 20)

add_executable(test test.cpp)

Activity

  1. sbc100 commented on Mar 27, 2024

    @sbc100
    Collaborator

    @dschuff should we start including this? This tool doesn't seem to exist on my debian-based system, is it new?

     $ which clang-scan-deps
     $ apt-cache search clang-scan-deps
    
  2. sbc100 commented on Mar 27, 2024

    @sbc100
    Collaborator

    Ah, I found it via sudo apt-get install clang-tools-17. Does that mean that CMake 3.28 with C++20 depends not just on the clang package but also on the clang-tools package?

  3. dschuff commented on Mar 27, 2024

    @dschuff
    Member

    Yes, clang-scan-deps is used with C++20 modules.
    Actually we got a recent request for this, #21042 and I thought I fixed it. But looking at that change, it maybe that it only affected non-release builds. Let me check on that some more.

  4. sbc100 commented on Mar 27, 2024

    @sbc100
    Collaborator

    I think maybe we don't build "clang/tools" at all yet on our builder.

  5. dschuff commented on Mar 29, 2024

    @dschuff
    Member

    I went ahead and did a minimal fix for this in https://chromium-review.googlesource.com/c/emscripten-releases/+/5402952 so the next release should be good. By the way, the non-LTO builds of emscripten-releases should have this binary in them already, so if you wanted to try it out you could use emsdk to install one of them, e.g. emsdk install 3.1.56-asserts

  6. sxstd001 commented on May 22, 2024

    @sxstd001

    Can you provide a simple example, including CMake configuration? I always encounter errors when compiling modules!

  7. sbc100 commented on May 22, 2024

    @sbc100
    Collaborator

    emscripten doesn't really have support for C++20 modules yet. Its something we should probably add tests for, but for now its not something that is easy to do. Just FYI

  8. Boris-Rasin commented on May 22, 2024

    @Boris-Rasin
    Author

    Just to note, this problem prevents using CMake 3.28 (or later) with C++20 (or later), even in a project without modules.

  9. sbc100 commented on May 22, 2024

    @sbc100
    Collaborator

    @Boris-Rasin I'm not seeing any iseeu with simply using C++20. For example, with the above CMakeLists.txt file I can run cmake 3.2.8 just fine:

    ./emcmake cmake -S . -B out/test/ 
    configure: cmake -S . -B out/test/  -DCMAKE_TOOLCHAIN_FILE=/usr/local/google/home/sbc/dev/wasm/emscripten/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_CROSSCOMPILING_EMULATOR=/usr/local/google/home/sbc/dev/wasm/emsdk/node/18.20.3_64bit/bin/node
    -- Configuring done (1.5s)
    -- Generating done (0.0s)
    -- Build files have been written to: /usr/local/google/home/sbc/dev/wasm/emscripten/out/test
    $ cmake --version
    cmake version 3.28.3
    

    What problems do you see when you don't use modules?

  10. Boris-Rasin commented on May 23, 2024

    @Boris-Rasin
    Author

    The problem I see is listed in this bug report title: "error: CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND".

    This happens with provided CMake file and empty "test.cpp" file.

    Which means it happens with a project that does not use modules.

    The error is during build, not during CMake config.

  11. sbc100 commented on May 23, 2024

    @sbc100
    Collaborator

    Thanks! I was able to reproduce now. Uploading a fix now.

  12. jpvanoosten commented on Jul 25, 2024

    @jpvanoosten

    Is this issue fixed on Windows?
    I'm using Emscripten 3.1.64 and using CMake 3.29 and with

    target_compile_features( ${TARGET} PUBLIC cxx_std_20 )
    

    I'm still getting the CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND error.

    Is this tool included in the Windows distributions?

    Note: I am not using modules, but CMake doesn't seem to care.

  13. sbc100 commented on Jul 31, 2024

    @sbc100
    Collaborator

    The fix for this has not yet landed.

  14. 11 remaining items

  15. added 3 commits that reference this issue on Jan 30, 2025
    a1b7e1e
    f18da5c
    209b704
  16. dschuff commented on Jan 30, 2025

    @dschuff
    Member

    This should be fixed by #21987

  17. hsdk123 commented on Jan 30, 2025

    @hsdk123

    @dschuff The issue seems to persist

  18. hsdk123 commented on Jan 30, 2025

    @hsdk123

    Actually,

    C:\Users\daego\Desktop\Projects\emsdk (main -> origin)
    λ .\emsdk list
    
    The *recommended* precompiled SDK download is 4.0.2 (cc8eba40de8235f9c33d92463018f87b3edaa09e).
    
    To install/activate it use:
             latest
    
    This is equivalent to installing/activating:
             4.0.2             INSTALLED
    
    All recent (non-legacy) installable versions are:
             4.0.2    INSTALLED
    

    When will we 4.0.3 be available?

  19. sbc100 commented on Jan 30, 2025

    @sbc100
    Collaborator

    Likely in a week or two. However you can try it today using emsdk install tot

  20. hsdk123 commented on May 26, 2025

    @hsdk123

    The implemented fix to this issue seems to cause another issue here:
    #24410

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions