Repository navigation
cpptool server select intelliSenseMode error when cross-compiling #13016
Copy link
Copy link
Closed
Labels
Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.quick fix
Milestone
Description
Environment
- OS and Version:
- Darwin 192.168.1.4 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:13:00 PDT 2024; root:xnu-10063.141.2~1/RELEASE_X86_64 x86_64
- VS Code Version:
- Version: 1.90.2
Commit: 5437499feb04f7a586f677b155b039bc2b3669eb
Date: 2024-06-18T22:37:41.291Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin x64 23.6.0 - C/C++ Extension Version:
ms-vscode.cpptools-1.22.11-darwin-x64
I use llvm-mingw compile windows execution file, on macOS
when I use cmake-tools set "configurationProvider": "ms-vscode.cmake-tools"
intelliSenseMode explicit set "intelliSenseMode": "windows-clang-x64"
explicit setting is coverd by configurationProvider setting
cmake-tool set intelliSenseMode undefined value, I see the source cmake-tool found this
then cpptool server select macos-clang-x64, but target platform error!!!
I think cpptool must select correct target platform(here is windows, not macos)by complie arg "--target=x86_64-w64-mingw32"
why!!!!


pr
Bug Summary and Steps to Reproduce
Bug Summary:
Steps to reproduce:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior:
Configuration and Logs
------IntelliSense Mode error come out------
c_cpp_properties.json file
{
"configurations": [
{
"name": "Win32",
"intelliSenseMode": "windows-clang-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
-------- Diagnostics - 2024/12/4 14:38:44
Version: 1.22.11
Current Configuration:
{
"name": "Win32",
"intelliSenseMode": "windows-clang-x64",
"configurationProvider": "ms-vscode.cmake-tools",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": false,
"cppStandardIsExplicit": false,
"intelliSenseModeIsExplicit": true,
"configurationProviderInCppPropertiesJson": "ms-vscode.cmake-tools",
"mergeConfigurations": false,
"compilerPath": "",
"browse": {
"path": [
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
Modified Settings:
{
"C_Cpp.default.compilerPath": ""
}
Additional Tracked Settings:
{
"editorTabSize": 4,
"editorInsertSpaces": true,
"editorAutoClosingBrackets": "languageDefined",
"filesEncoding": "utf8",
"filesAssociations": {
"*.cpp": "cpp",
"*.qrc": "xml"
},
"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/admin/desktop/zzz/build/tiktok_autogen/include",
"/users/admin/desktop/zzz/build/tiktok_autogen",
"/users/admin/desktop/zzz/untitled1",
"/users/admin/desktop/zzz/untitled1/decoder",
"/users/admin/desktop/zzz/build/cmakefiles",
"/users/admin/desktop/zzz/build/untitled1_autogen/include",
"/users/admin/desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/qt6/qtcore",
"/users/admin/desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/qt6",
"/users/admin/desktop/zzz/build/vcpkg_installed/x64-mingw-static/share/qt6/mkspecs/win32-clang-g++",
"/users/admin/desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/qt6/qtwidgets",
"/users/admin/desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/qt6/qtgui",
"/users/admin/desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/qt6/qtconcurrent",
"/users/admin/desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/qt6/qtsql",
"/users/admin/desktop/zzz/build/untitled1_autogen",
"/users/admin/desktop/zzz/build/.qt/rcc",
"/users/admin/desktop/zzz/build",
"/users/admin/desktop/zzz/build/.lupdate"
],
"compilerPath": "/users/admin/downloads/llvm-mingw-20240619-ucrt-macos-universal/bin/x86_64-w64-mingw32-clang++",
"compilerArgs": [],
"compilerFragments": [
"--target=x86_64-w64-mingw32"
]
}
cpptools version (native): 1.22.11.0
Current database path: /Users/admin/Library/Caches/vscode-cpptools/e9acf0dcf0e1945427ffa2a4ed6ec66a/.browse.VC.db
Translation Unit Mappings:
[ /Users/admin/Desktop/zzz/untitled1/main.cpp - source TU]:
Translation Unit Configurations:
[ /Users/admin/Desktop/zzz/untitled1/main.cpp ]
Process ID: 2659
Memory Usage: 172 MB
Compiler Path: /users/admin/downloads/llvm-mingw-20240619-ucrt-macos-universal/bin/x86_64-w64-mingw32-clang++
Includes:
/Users/admin/Desktop/zzz/build/untitled1_autogen/include
/Users/admin/Desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/Qt6/QtCore
/Users/admin/Desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/Qt6
/Users/admin/Desktop/zzz/build/vcpkg_installed/x64-mingw-static/share/Qt6/mkspecs/win32-clang-g++
/Users/admin/Desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/Qt6/QtWidgets
/Users/admin/Desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/Qt6/QtGui
/Users/admin/Desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/Qt6/QtConcurrent
/Users/admin/Desktop/zzz/build/vcpkg_installed/x64-mingw-static/include/Qt6/QtSql
System Includes:
/Users/admin/Downloads/llvm-mingw-20240619-ucrt-macos-universal/generic-w64-mingw32/include/c++/v1
/Users/admin/Downloads/llvm-mingw-20240619-ucrt-macos-universal/lib/clang/18/include
/Users/admin/Downloads/llvm-mingw-20240619-ucrt-macos-universal/generic-w64-mingw32/include
Defines:
BX_INSTR_STORE_OPCODE_BYTES
BX_STANDALONE_DECODER
QT_CONCURRENT_LIB
QT_CORE_LIB
QT_GUI_LIB
QT_NEEDS_QMAIN
QT_NO_DEBUG
QT_NO_DEBUG_OUTPUT
QT_SQL_LIB
QT_WIDGETS_LIB
UNICODE
WIN32
WIN64
WINVER=0x0A00
_ENABLE_EXTENDED_ALIGNED_STORAGE
_UNICODE
_WIN32_WINNT=0x0A00
_WIN64
adf=1
NDEBUG
Standard Version: c++17
IntelliSense Mode: macos-clang-x64
Other Flags:
--clang
--clang_version=180108
Total Memory Usage: 172 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 15035Other Extensions
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.Check the Milestone for the release in which the fix is or will be available.quick fix
Type
Projects
- StatusShow more project fieldsDone
Activity
debugee commentedon Dec 4, 2024
when cpptools select incorrect mode “macos-clang-x64” (correct is windows-clang-x64)
cpptools server will add some define in bin/macos-clang-x64.json file (
{
"defaults": [
"-D__building_module(x)=0",
"--pack_alignment",
"8",
"-D__APPLE__=1",
"-D__MACH__=1",
"-D__x86_64=1",
"-D__x86_64__=1",
"-D__PTRDIFF_TYPE__=long int",
"-D__SIZE_TYPE__=long unsigned int",
"-D__WCHAR_TYPE__=int"
],
"defaults_op": "merge"
}
)
so error mode select error macro defined
APPLE define 1
error come out here
Colengms commentedon Dec 6, 2024
Hi debugee (@debugee) . The (first) code you are referring to as the source of the issue appears to be in CMake Tools. Did you intent to open this issue against CMake Tools? If so, I can forward it to https://github.com/microsoft/vscode-cmake-tools/issues . Though, since you're using a recent version of the C/C++ extension, the
useFragmentsvariable you're referring to would be true, so should not execute the block you're referring to.Could you enable
"C_Cpp.loggingLevel": "Debug"and provide the output from theC/C++output channel - specifically where it indicates the configuration being provided by CMake Tools for that source file? That should indicate exactly what CMake Tools is providing and clarify whether the issue is with CMake Tools or the C/C++ Extension. Also, could you do that with the latest pre-release version (1.23.2) to confirm the issue has not already been addressed and ensure any recently added logging will be included?debugee commentedon Dec 7, 2024
bug is clearly,cpptool server selected mode error when cross-compile。cpptool bin server select mode use compile and args while mode undefined,but it auto select error,cmake-tool can set mode or not,this is it freedom,when cmake-tool want cpptool server select mode use compile and arg(like x86_64_w64_mingw,platform is must windows),but select error,that the problem。
debugee commentedon Dec 7, 2024
bug is clearly,cpptool server selected mode error when cross-compile。cpptool bin server select mode use compile and args while mode undefined,but it auto select error,cmake-tool can set mode or not,this is it freedom,when cmake-tool want cpptool server select mode use compile and arg(like x86_64_w64_mingw,platform is must windows),but select error,that the problem。
debugee commentedon Dec 11, 2024
Don’t you have the courage to admit the bug? cant solve the problem?
sean-mcmanus commentedon Dec 11, 2024
debugee (@debugee) You have
"configurationProvider": "ms-vscode.cmake-tools"so we believe the incorrect macos IntelliSense mode is coming from that extension and not ours. We're requesting the C/C++ logging that starts with "Custom configurations received:".bobbrow commentedon Dec 12, 2024
Sean McManus (@sean-mcmanus), actually, I think CMake Tools sends us no value for
intelliSenseModenow and we're supposed to determine the mode based on the--targets=arg. I believe it has been this way since microsoft/vscode-cmake-tools#1789sean-mcmanus commentedon Dec 12, 2024
Bob Brown (@bobbrow) Yeah, I mean coming from CMake Tools due to the compilerArgs/Fragments they're sending us. However, looking at our --target handling code, I don't see any code that checks the target for -w64- or mingw to converting the IntelliSense mode to Windows, so if that's what needs to happen then it would be our bug.
bobbrow commentedon Dec 12, 2024
I'm not 100% sure based on the earlier screenshots if this is happening, but you may also want to check and see if both
_WIN32and__APPLE__are getting defined.sean-mcmanus commentedon Dec 12, 2024
Bob Brown (@bobbrow)
__APPLE__is defined in the screenshot due to the macos IntelliSense mode. I don't see any logging indication that__APPLE__is defined elsewhere.3 remaining items
debugee commentedon Dec 16, 2024
谢谢你能看懂并解决我的问题,我是一个中国boy
你们不考虑开源cpptools吗
sean-mcmanus commentedon Dec 16, 2024
debugee (@debugee) Are you asking about open sourcing the cpptools process? We are not planning to open source the cpptools/cpptools-srv processes, which are covered by a special license at https://github.com/microsoft/vscode-cpptools/blob/main/RuntimeLicenses/cpptools-LICENSE.txt .
sean-mcmanus commentedon Jan 10, 2025
debugee (@debugee) Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.23.3 (pre-release).