microsoft / microsoft/vscode-cmake-tools

cmake-tools keeps sending hint "language modes specified are incompatible" to cpp-tools

Open
#2,881 6 comments 0 reactions 0 assignees View on GitHub
Feature: configure upstream
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

The error squiggle exists on the first line of every .c file and it shows the hint "language modes specified are incompatible". At first, I thought the problem was from cpp-tools, however after I changed `configurationProvider` to `None`, the problem had gone.

I found an issue with cpp-tools https://github.com/microsoft/vscode-cpptools/issues/9684, and it said the problem was that configurationProvider sends the wrong command to cpp-tools. So maybe the problem is from cmake-tools?

### CMake Tools Diagnostics

```shell
{
"os": "linux",
"vscodeVersion": "1.73.1",
"cmtVersion": "1.12.27",
"configurations": [
{
"folder": "/home/xieyun/code/agent-libs",
"cmakeVersion": "3.22.1",
"configured": true,
"generator": "Unix Makefiles",
"usesPresets": false,
"compilers": {
"C": "/usr/bin/gcc",
"CXX": "/usr/bin/g++"
}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Debug",
"buildTypesSeen": [
"Debug"
],
"requests": [
"file:///home/xieyun/code/agent-libs/driver/main.c",
"file:///home/xieyun/code/agent-libs/driver/ppm_cputime.c"
],
"responses": [],
"partialMatches": [],
"targetCount": 23,
"executablesCount": 4,
"librariesCount": 6,
"targets": []
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
```

### Debug Log

```shell
[main] Configuring folder: agent-libs
[main] Saving open files before configure/build
[driver] Start configure
[driver] Running pre-configure checks and steps
[driver] Using compilers in GCC 11.3.0 x86_64-linux-gnu for configure
[cmakefileapi-driver] Configuring using kit
[cmakefileapi-driver] Invoking CMake /usr/bin/cmake with arguments ["--no-warn-unused-cli","-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE","-DCMAKE_BUILD_TYPE:STRING=Debug","-DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc","-DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++","-S/home/xieyun/code/agent-libs","-B/home/xieyun/code/agent-libs/build","-G","Unix Makefiles"]
[proc] Executing command: /usr/bin/cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ -S/home/xieyun/code/agent-libs -B/home/xieyun/code/agent-libs/build -G "Unix Makefiles"
[cmake] CMake Deprecation Warning at CMakeLists.txt:34 (cmake_minimum_required):
[cmake] Compatibility with CMake < 2.8.12 will be removed from a future version of
[cmake] CMake.
[cmake]
[cmake] Update the VERSION argument value or use a ... suffix to tell
[cmake] CMake that the project does not need compatibility with older versions.
[cmake]
[cmake]
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Warning (dev) at CMakeLists.txt:36 (project):
[cmake] Policy CMP0048 is not set: project() command manages VERSION variables.
[cmake] Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
[cmake] command to set the policy and suppress this warning.
[cmake]
[cmake] The following variable(s) would be set to empty:
[cmake]
[cmake] CMAKE_PROJECT_VERSION
[cmake] CMAKE_PROJECT_VERSION_MAJOR
[cmake] CMAKE_PROJECT_VERSION_MINOR
[cmake] CMAKE_PROJECT_VERSION_PATCH
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- Using bundled zlib in '/home/xieyun/code/agent-libs/build/zlib-prefix/src/zlib'
[cmake] -- Using bundled tbb in '/home/xieyun/code/agent-libs/build/tbb-prefix/src/tbb'
[cmake] -- Using bundled b64 in '/home/xieyun/code/agent-libs/build/b64-prefix/src/b64'
[cmake] -- Using bundled jq in '/home/xieyun/code/agent-libs/build/jq-prefix/src/jq'
[cmake] -- Bundled jq: include: /home/xieyun/code/agent-libs/build/jq-prefix/src/jq/target/include, lib: /home/xieyun/code/agent-libs/build/jq-prefix/src/jq/target/lib/libjq.a
[cmake] -- Using bundled jsoncpp in '/home/xieyun/code/agent-libs/cmake/modules/../../userspace/libsinsp/third-party/jsoncpp'
[cmake] -- Using bundled c-ares in '/home/xieyun/code/agent-libs/build/c-ares-prefix/src/c-ares'
[cmake] -- Using bundled openssl in '/home/xieyun/code/agent-libs/build/openssl-prefix/src/openssl'
[cmake] -- Using bundled curl in '/home/xieyun/code/agent-libs/build/curl-prefix/src/curl'
[cmake] -- Using SSL for curl in '--with-ssl=/home/xieyun/code/agent-libs/build/openssl-prefix/src/openssl/target'
[cmake] -- Using bundled jsoncpp in '/home/xieyun/code/agent-libs/cmake/modules/../../userspace/libsinsp/third-party/jsoncpp'
[cmake] -- Using bundled protobuf in '/home/xieyun/code/agent-libs/build/protobuf-prefix/src/protobuf'
[cmake] -- Using bundled grpc in '/home/xieyun/code/agent-libs/build/grpc-prefix/src/grpc'
[cmake] -- Using bundled jsoncpp in '/home/xieyun/code/agent-libs/cmake/modules/../../userspace/libsinsp/third-party/jsoncpp'
[cmake] CMake Deprecation Warning at CMakeLists.txt:17 (cmake_minimum_required):
[cmake] Compatibility with CMake < 2.8.12 will be removed from a future version of
[cmake] CMake.
[cmake]
[cmake] Update the VERSION argument value or use a ... suffix to tell
[cmake] CMake that the project does not need compatibility with older versions.
[cmake]
[cmake]
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /home/xieyun/code/agent-libs/build/googletest-download
[cmake] [ 11%] Performing update step for 'googletest'
[cmake] HEAD is now at a16bfcfd Disables `-Wunused-member-function` and `-Wused-but-marked-unused` that trigger via `MOCK_METHOD()` and `EXPECT_THAT()` macros.
[cmake] [ 22%] No patch step for 'googletest'
[cmake] [ 33%] No configure step for 'googletest'
[cmake] [ 44%] No build step for 'googletest'
[cmake] [ 55%] No install step for 'googletest'
[cmake] [ 66%] No test step for 'googletest'
[cmake] [ 77%] Completed 'googletest'
[cmake] [100%] Built target googletest
[cmake] -- Configuring done
[cmake] -- Generating done
[cmake] -- Build files have been written to: /home/xieyun/code/agent-libs/build
[cmakefileapi-parser] Read reply folder: /home/xieyun/code/agent-libs/build/.cmake/api/v1/reply
[cmakefileapi-parser] Found index files: ["cache-v2-2625f1003b3af989f6da.json","cmakeFiles-v1-d1761cc587b7c067e62e.json","codemodel-v2-0d4540af946c091a9a34.json","directory-.-Debug-f5ebdc15457944623624.json","directory-driver-Debug-9eb2b321b14f5ae2cbc9.json","directory-driver.bpf-Debug-4718dc2a300008520d37.json","directory-googletest-build-Debug-ad89e8633cc40902e10f.json","directory-googletest-build.googlemock-Debug-615938ffd500e20b0ffb.json","directory-googletest-build.googletest-Debug-15b90499031de201d2f3.json","directory-libscap-Debug-f96d44d50126ff36deb1.json","directory-libscap.examples.01-open-Debug-19f5d6f26408fc363b85.json","directory-libscap.examples.02-validatebuffer-Debug-9aace973c8a61bfc28f0.json","directory-libsinsp-Debug-2a7820642db5776a2202.json","directory-libsinsp.examples-Debug-d72e5dcd259202b6c929.json","directory-libsinsp.test-Debug-ddbbe5b53a953f92bfeb.json","index-2022-12-02T08-27-23-0054.json","target-b64-Debug-eb7836b55930635c678d.json","target-c-ares-Debug-1bd3cf7b868d8205c430.json","target-curl-Debug-37b51f3b5b0f04fd7882.json","target-driver-Debug-b9de30f81609c7009033.json","target-gmock-Debug-60188a5e833b829be447.json","target-gmock_main-Debug-95eb647a6460ecd4a9ff.json","target-grpc-Debug-11062f22044b41545fe3.json","target-gtest-Debug-512c7d18c6fb6e635437.json","target-gtest_main-Debug-16203695ad55e69613f4.json","target-install_driver-Debug-05b6634b04d596b83b4e.json","target-jq-Debug-d40a86a81df0e30a9899.json","target-openssl-Debug-cd6016c8286d1f8b2a8e.json","target-protobuf-Debug-60a28a885488cf4d6dad.json","target-run-unit-test-libsinsp-Debug-5069e683fcc54aeb0c37.json","target-run-unit-tests-Debug-f8f57a4b76779996dd41.json","target-scap-Debug-a587c178a5e3165b8767.json","target-scap-open-Debug-8abd348c245e29cbaebd.json","target-scap-validatebuffer-Debug-b309d02a2f20569dd845.json","target-sinsp-Debug-7766d57736ed6d851e7e.json","target-sinsp-example-Debug-2cdc6f2475b682ae9f70.json","target-tbb-Debug-f6ae6c1e2ef2fe88b031.json","target-unit-test-libsinsp-Debug-15dee8260bdde44e9601.json","target-zlib-Debug-8930a56968bc72af9e16.json","toolchains-v1-074db5775ec40502811a.json"]
[cache] Reading CMake cache file /home/xieyun/code/agent-libs/build/CMakeCache.txt
[cache] Parsing CMake cache string
[extension] [6928] cmake.configure finished (returned 0)
```

### Additional Information

The c_cpp_properties.json:

```
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}",
"/usr/src/linux-headers-5.15.0-52-generic/include"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
// "cStandard": "gnu17",
// "cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the CMake Tools configurationProvider integration and compare the command it sends to cpp-tools with the reported cpp-tools issue. Reproduce the warning on the first line of a .c file using the supplied CMake project and diagnostics, then verify that the warning is absent while configurationProvider remains enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cmake, cpp
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.