microsoft / microsoft/vscode-cmake-tools
Language server does not report path to SDK when using Xcode generator
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
### Environment
- OS and Version: macOS 14.5
- VS Code Version: 1.96.4 (Universal)
- C/C++ Extension Version: 1.23.5.0
### Bug Summary and Steps to Reproduce
Minimal repo to reproduce: https://gist.github.com/alexbatalov/d364a78251d0c0d887a221a2cc0cf41f
Select `unix makefiles` preset, observe there is no include error in the `main.c`. Select `xcode` preset, observe include error.
### Configuration and Logs
```shell
All defaults (implying cmake-tools configuration provider).
```
### Other Extensions
ms-vscode.cmake-tools (1.19.52)
### Additional context
Here is diagnostics log from `unix makefiles` preset:
```
Version: 1.23.5
Current Configuration:
{
"name": "Mac",
"includePath": [
"/Users/alex/dev/sample/**"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64",
"compilerPathInCppPropertiesJson": "/usr/bin/clang",
"intelliSenseModeIsExplicit": false,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"mergeConfigurations": false,
"compilerPathIsExplicit": false,
"configurationProvider": "ms-vscode.cmake-tools",
"browse": {
"path": [
"/Users/alex/dev/sample/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "utf8",
"filesAssociations": {
"stdio.h": "c"
},
"filesExclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},
"filesAutoSaveAfterDelay": false,
"editorInlayHintsEnabled": true,
"editorParameterHintsEnabled": true,
"searchExclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
},
"workbenchSettingsEditor": "ui"
}
Custom browse configuration:
{
"browsePath": [
"/users/alex/dev/sample"
],
"compilerPath": "/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/cc",
"compilerArgs": [],
"compilerFragments": [
" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk -mmacosx-version-min=14.5"
]
}
cpptools version (native): 1.23.5.0
Current database path: /Users/alex/Library/Caches/vscode-cpptools/574f383c91e984d4b69b86e95ab00552/.browse.VC.db
Translation Unit Mappings:
[ /Users/alex/dev/sample/main.c - source TU]:
Translation Unit Configurations:
[ /Users/alex/dev/sample/main.c ]
Process ID: 4728
Memory Usage: 15 MB
Compiler Path: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/cc
Includes:
System Includes:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
Frameworks:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/System/Library/Frameworks
Standard Version: c17
IntelliSense Mode: macos-clang-x64
Other Flags:
--clang
--clang_version=170006
Total Memory Usage: 15 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 3283
```
And here are for the `xcode` preset:
```
Version: 1.23.5
Current Configuration:
{
"name": "Mac",
"includePath": [
"/Users/alex/dev/sample/**"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX14.5.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-x64",
"compilerPathInCppPropertiesJson": "/usr/bin/clang",
"intelliSenseModeIsExplicit": false,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"mergeConfigurations": false,
"compilerPathIsExplicit": false,
"configurationProvider": "ms-vscode.cmake-tools",
"browse": {
"path": [
"/Users/alex/dev/sample/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "utf8",
"filesAssociations": {
"stdio.h": "c"
},
"filesExclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
},
"filesAutoSaveAfterDelay": false,
"editorInlayHintsEnabled": true,
"editorParameterHintsEnabled": true,
"searchExclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
},
"workbenchSettingsEditor": "ui"
}
Custom browse configuration:
{
"browsePath": [
"/users/alex/dev/sample/out/build/xcode/cmakefiles",
"/users/alex/dev/sample"
],
"compilerPath": "/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang",
"compilerArgs": [],
"compilerFragments": [
"-g"
]
}
cpptools version (native): 1.23.5.0
Current database path: /Users/alex/Library/Caches/vscode-cpptools/574f383c91e984d4b69b86e95ab00552/.browse.VC.db
Translation Unit Mappings:
[ /Users/alex/dev/sample/main.c - source TU]:
Translation Unit Configurations:
[ /Users/alex/dev/sample/main.c ]
Process ID: 4774
Memory Usage: 13 MB
Compiler Path: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang
Includes:
System Includes:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/16/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
Frameworks:
/System/Library/Frameworks
/Library/Frameworks
Standard Version: c17
IntelliSense Mode: macos-clang-x64
Other Flags:
--clang
--clang_version=170006
Total Memory Usage: 13 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 16640
```
Path to SDK (`/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk/`) is missing, hence include error. I'm not sure if that's `vscode-cpptools` or `vscode-cmake-tools` fault.
Contributor guide
Research direction
Reproduce the issue with the linked minimal repository by selecting the Unix Makefiles and Xcode presets in the CMake Tools configuration provider. Compare the generated IntelliSense configuration and confirm that the Xcode preset includes the macOS SDK path so the include error in main.c is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100