Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Boris-Rasin opened this issue Mar 27, 2024 · 20 comments
Closed

Comments

@Boris-Rasin
Copy link

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)
@sbc100
Copy link
Collaborator

sbc100 commented Mar 27, 2024

@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

@sbc100
Copy link
Collaborator

sbc100 commented Mar 27, 2024

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?

@dschuff
Copy link
Member

dschuff commented Mar 27, 2024

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.

@sbc100
Copy link
Collaborator

sbc100 commented Mar 27, 2024

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

@dschuff
Copy link
Member

dschuff commented Mar 29, 2024

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

@sxstd001
Copy link

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

@sbc100
Copy link
Collaborator

sbc100 commented May 22, 2024

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

@Boris-Rasin
Copy link
Author

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

@sbc100
Copy link
Collaborator

sbc100 commented May 22, 2024

@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?

@Boris-Rasin
Copy link
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.

@sbc100
Copy link
Collaborator

sbc100 commented May 23, 2024

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

@jpvanoosten
Copy link

jpvanoosten commented Jul 25, 2024

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.

@sbc100
Copy link
Collaborator

sbc100 commented Jul 31, 2024

The fix for this has not yet landed.

@sbc100 sbc100 transferred this issue from emscripten-core/emsdk Jul 31, 2024
christianbrugger added a commit to christianbrugger/logiksim that referenced this issue Oct 20, 2024
@tuket
Copy link

tuket commented Oct 23, 2024

Any know workaround? I can think of:

  • Using CMake <= 3.27
  • Using C++ <= 17

@eliemichel
Copy link

Workaround that imports the bits of PR#21987: https://github.com/eliemichel/cpp20-cmake-emscripten-template

wheelerMT pushed a commit to wheelerMT/GSMP that referenced this issue Nov 15, 2024
@hsdk123
Copy link

hsdk123 commented Jan 25, 2025

Any updates? This is still an issue and prevents using c++20

sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 29, 2025
This is wrapper around clang-scan-deps.  Currently this is just enough
to make C++20 work under cmake.  We don't currently have any actaully
tests of C++20 modules.

See: emscripten-core#21042
Fixes: emscripten-core#22305
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 29, 2025
This is wrapper around clang-scan-deps.  Currently this is just enough
to make C++20 work under cmake.  We don't currently have any actaully
tests of C++20 modules.

See: emscripten-core#21042
Fixes: emscripten-core#22305
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 29, 2025
This is wrapper around clang-scan-deps.  Currently this is just enough
to make C++20 work under cmake.  We don't currently have any actaully
tests of C++20 modules.

See: emscripten-core#21042
Fixes: emscripten-core#22305
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 30, 2025
This is wrapper around clang-scan-deps.  Currently this is just enough
to make C++20 work under cmake.  We don't currently have any actaully
tests of C++20 modules.

See: emscripten-core#21042
Fixes: emscripten-core#22305
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 30, 2025
This is wrapper around clang-scan-deps.  Currently this is just enough
to make C++20 work under cmake.  We don't currently have any actaully
tests of C++20 modules.

See: emscripten-core#21042
Fixes: emscripten-core#22305
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 30, 2025
This is wrapper around clang-scan-deps.  Currently this is just enough
to make C++20 work under cmake.  We don't currently have any actaully
tests of C++20 modules.

See: emscripten-core#21042
Fixes: emscripten-core#22305
p-senichenkov added a commit to p-senichenkov/Desbordante that referenced this issue Jan 30, 2025
Add `export CC=...`, because otherwise CMake fails to locate a tool
for scanning C++ module dependencies (no matter we don't use modules):
emscripten-core/emscripten#22305
p-senichenkov added a commit to p-senichenkov/Desbordante that referenced this issue Jan 30, 2025
Add `export CC=...`, because otherwise CMake fails to locate a tool
for scanning C++ module dependencies (no matter we don't use modules):
emscripten-core/emscripten#22305
Vdaleke pushed a commit to p-senichenkov/Desbordante that referenced this issue Jan 30, 2025
Add `export CC=...`, because otherwise CMake fails to locate a tool
for scanning C++ module dependencies (no matter we don't use modules):
emscripten-core/emscripten#22305
p-senichenkov added a commit to p-senichenkov/Desbordante that referenced this issue Jan 30, 2025
Add `export CC=...`, because otherwise CMake fails to locate a tool
for scanning C++ module dependencies (no matter we don't use modules):
emscripten-core/emscripten#22305
p-senichenkov added a commit to p-senichenkov/Desbordante that referenced this issue Jan 30, 2025
Add `export CC=...`, because otherwise CMake fails to locate a tool
for scanning C++ module dependencies (no matter we don't use modules):
emscripten-core/emscripten#22305
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 30, 2025
This is wrapper around clang-scan-deps.  Currently this is just enough
to make C++20 work under cmake.  We don't currently have any actaully
tests of C++20 modules.

See: emscripten-core#21042
Fixes: emscripten-core#22305
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 30, 2025
This is wrapper around clang-scan-deps.  Currently this is just enough
to make C++20 work under cmake.  We don't currently have any actaully
tests of C++20 modules.

See: emscripten-core#21042
Fixes: emscripten-core#22305
sbc100 added a commit that referenced this issue Jan 30, 2025
This is wrapper around clang-scan-deps. Currently this is just enough to
make C++20 work under cmake. We don't currently have any actaully tests
of C++20 modules.

See: #21042
Fixes: #21866 #22305
@dschuff
Copy link
Member

dschuff commented Jan 30, 2025

This should be fixed by #21987

@dschuff dschuff closed this as completed Jan 30, 2025
@hsdk123
Copy link

hsdk123 commented Jan 30, 2025

@dschuff The issue seems to persist

@hsdk123
Copy link

hsdk123 commented Jan 30, 2025

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?

@sbc100
Copy link
Collaborator

sbc100 commented Jan 30, 2025

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

chernishev pushed a commit to Desbordante/desbordante-core that referenced this issue Feb 1, 2025
Add `export CC=...`, because otherwise CMake fails to locate a tool
for scanning C++ module dependencies (no matter we don't use modules):
emscripten-core/emscripten#22305
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants