Skip to content

cpptool server select intelliSenseMode error when cross-compiling #13016

Closed

Description

@debugee

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!!!!
Image
Image

pr

Bug Summary and Steps to Reproduce

Bug Summary:

Steps to reproduce:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. 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): 15035

Other Extensions

No response

Additional context

No response

Activity

  1. debugee commented on Dec 4, 2024

    @debugee
    Author

    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

    Image

    Image

    error come out here

  2. Colengms commented on Dec 6, 2024

    @Colengms
    Contributor

    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 useFragments variable 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 the C/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?

  3. debugee commented on Dec 7, 2024

    @debugee
    Author

    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。

  4. debugee commented on Dec 7, 2024

    @debugee
    Author

    Hi @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 useFragments variable 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 the C/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?

    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。

  5. debugee commented on Dec 11, 2024

    @debugee
    Author

    Hi @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 useFragments variable 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 the C/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?

    Don’t you have the courage to admit the bug? cant solve the problem?

  6. sean-mcmanus commented on Dec 11, 2024

    @sean-mcmanus
    Contributor

    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:".

  7. bobbrow commented on Dec 12, 2024

    @bobbrow
    Contributor

    Sean McManus (@sean-mcmanus), actually, I think CMake Tools sends us no value for intelliSenseMode now 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#1789

  8. sean-mcmanus commented on Dec 12, 2024

    @sean-mcmanus
    Contributor

    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.

  9. bobbrow commented on Dec 12, 2024

    @bobbrow
    Contributor

    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 _WIN32 and __APPLE__ are getting defined.

  10. sean-mcmanus commented on Dec 12, 2024

    @sean-mcmanus
    Contributor

    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.

  11. 3 remaining items

  12. moved this from In progress to Pull Request in cpptoolson Dec 13, 2024
  13. moved this from Pull Request to Done in cpptoolson Dec 14, 2024
  14. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    on Dec 14, 2024
  15. debugee commented on Dec 16, 2024

    @debugee
    Author

    谢谢你能看懂并解决我的问题,我是一个中国boy
    你们不考虑开源cpptools吗

  16. sean-mcmanus commented on Dec 16, 2024

    @sean-mcmanus
    Contributor

    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 .

  17. sean-mcmanus commented on Jan 10, 2025

    @sean-mcmanus
    Contributor
  18. locked and limited conversation to collaborators on Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Language ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.quick fix

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions