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

Unable to use the extension when cmake.sourceDirectory is a subdirectory #3121

Closed
FtZPetruska opened this issue Apr 20, 2023 · 9 comments · Fixed by #3122
Closed

Unable to use the extension when cmake.sourceDirectory is a subdirectory #3121

FtZPetruska opened this issue Apr 20, 2023 · 9 comments · Fixed by #3122
Labels
bug a bug in the product regression used to work and no longer does. Regressions are typically high priority
Milestone

Comments

@FtZPetruska
Copy link

FtZPetruska commented Apr 20, 2023

Brief Issue Summary

Starting version 1.14.29, the extension fails to work when the source directory is not the root of the workspace.

Whether the project is already configured or not, the CMake/Build tab in OUTPUT reads:

Unhandled exception: Failed to open CMake cache file on code model update Folder is not found in Test Explorer: /users/ganyu/git/dsda-doom/prboom2 {}

For reference, the workspace path is /users/ganyu/git/dsda-doom, and the top-level CMakeLists.txt is located in the subdirectory prboom2, and set through this workspace setting:

"cmake.sourceDirectory": "${workspaceFolder}/prboom2"

When this error happens, the CPU usage skyrockets, and no command from the status bar or the command palette have any effect.

It should be noted that this issue does not happen when then CMakeLists.txt is at the root of the directory.

CMake Tools Diagnostics

{
  "os": "darwin",
  "vscodeVersion": "1.77.3",
  "cmtVersion": "1.14.29",
  "configurations": [
    {
      "folder": "/Users/ganyu/git/dsda-doom",
      "cmakeVersion": "unknown",
      "configured": false,
      "generator": "unknown",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": null
    }
  ]
}

Debug Log

[main] Starting new CMake driver
[main] Starting CMake driver
[main] Using generator from user configuration: Ninja
[cmakefileapi-driver] Creating instance of CMakeFileApiDriver
[driver] Initializating base driver using kit
[kit] Testing Clang binary: /usr/bin/clang
[proc] Executing command: /usr/bin/clang -v
[kit] Detected Clang compiler: /usr/bin/clang
[driver] CMakeDriver Kit set to Clang 14.0.0 arm64-apple-darwin21.6.0
[kit] The environment for kit 'Clang 14.0.0 arm64-apple-darwin21.6.0': {
  "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
  "CMAKE_GENERATOR": "Ninja",
  "COMMAND_MODE": "unix2003",
  "DISPLAY": "/private/tmp/com.apple.launchd.vhtLMmhK1P/org.xquartz:0",
  "EDITOR": "nvim",
  "ELECTRON_NO_ATTACH_CONSOLE": "1",
  "HOME": "/Users/ganyu",
  "HOMEBREW_CELLAR": "/opt/homebrew/Cellar",
  "HOMEBREW_PREFIX": "/opt/homebrew",
  "HOMEBREW_REPOSITORY": "/opt/homebrew",
  "INFOPATH": "/opt/homebrew/share/info:",
  "LANG": "en_GB.UTF-8",
  "LESSHISTFILE": "/Users/ganyu/.cache/less/history",
  "LESS_TERMCAP_mb": "\u001b[1;31m",
  "LESS_TERMCAP_md": "\u001b[1;36m",
  "LESS_TERMCAP_me": "\u001b[0m",
  "LESS_TERMCAP_se": "\u001b[0m",
  "LESS_TERMCAP_so": "\u001b[01;33m",
  "LESS_TERMCAP_ue": "\u001b[0m",
  "LESS_TERMCAP_us": "\u001b[1;32m",
  "LOGNAME": "ganyu",
  "MANPATH": "/opt/homebrew/share/man::",
  "MallocNanoZone": "0",
  "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined",
  "PAGER": "less",
  "PATH": "/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/devkitpro/tools/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin",
  "PWD": "/Users/ganyu",
  "SHELL": "/opt/homebrew/bin/zsh",
  "SHELL_SESSIONS_DISABLE": "1",
  "SHLVL": "2",
  "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.ifgPJL8VDY/Listeners",
  "TERM": "xterm-256color",
  "TERM_PROGRAM": "Apple_Terminal",
  "TERM_PROGRAM_VERSION": "447",
  "TERM_SESSION_ID": "C5104603-BD80-41AB-A96D-FA2371358A74",
  "TMPDIR": "/var/folders/pm/wyy2q8sn3qj235t35_w1pgbm0000gn/T/",
  "USER": "ganyu",
  "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
  "VSCODE_CLI": "1",
  "VSCODE_CODE_CACHE_PATH": "/Users/ganyu/Library/Application Support/Code/CachedData/704ed70d4fd1c6bd6342c436f1ede30d1cff4710",
  "VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
  "VSCODE_CWD": "/Users/ganyu",
  "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
  "VSCODE_IPC_HOOK": "/Users/ganyu/Library/Application Support/Code/1.77-main.sock",
  "VSCODE_NLS_CONFIG": "{\"locale\":\"en\",\"osLocale\":\"en-gb\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
  "VSCODE_PID": "6659",
  "XPC_FLAGS": "0x0",
  "XPC_SERVICE_NAME": "application.com.microsoft.VSCode.62244229.62244235.2454D30D-8EA9-4344-A2EA-890CA5926AEB",
  "__CFBundleIdentifier": "com.microsoft.VSCode",
  "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x2",
  "ELECTRON_RUN_AS_NODE": "1",
  "VSCODE_L10N_BUNDLE_LOCATION": ""
}
[driver] Setting new variant RelWithDebInfo
[rollbar] Unhandled exception: Failed to open CMake cache file on code model update Folder is not found in Test Explorer: /users/ganyu/git/dsda-doom/prboom2 {}

Additional Information

Here is a sample project to reproduce the issue:

toplevel/
|- subdir/
| |- CMakeLists.txt

Content of toplevel/.vscode/settings.json:

{
  "cmake.sourceDirectory": "/path/to/toplevel/subdir"
}

Content of toplevel/subdir/CMakeLists.txt:

cmake_minimum_required(VERSION 3.0)
project(repro)

message("Hello world")
@chriskerluke
Copy link

I am having the same issue

@FtZPetruska FtZPetruska changed the title Unable to use Unable to use the extension when cmake.sourceDirectory is a subdirectory Apr 20, 2023
@joshua-nmi
Copy link

I also have the same issue.

@hlmodi
Copy link

hlmodi commented Apr 20, 2023

Same issue here....

@thirtytwobits
Copy link

thirtytwobits commented Apr 20, 2023

+1. Tried cleaning every vscode cache I could find on osx. Happens on linux containers too.

Also confirmed that version 1.13.45 does not have the issue. 1.14 is a poison pill.

@bobbrow
Copy link
Member

bobbrow commented Apr 20, 2023

I have a PR out to fix this. Until we release an update, you have a few options:

  • Revert back to a previous version of the extension
    1. Open the Extensions Panel
    2. Click the gear icon on the CMake Tools item
    3. Select "Install Another Version..."
    4. Select 1.13.45 from the list
  • Patch this version manually
    1. Find the folder where VS Code installs your extensions (something like $HOME/.vscode/extensions)
    2. Open ms-vscode.cmake-tools-1.14.29\dist\main.js
    3. Goto line 38947
    4. replace project.folderPath with project.sourceDir
    5. Goto line 38948
    6. replace project.folderPath with project.sourceDir

@bobbrow
Copy link
Member

bobbrow commented Apr 20, 2023

I've been working with @benmcmorran to prep a patch release which should go out pretty soon. You can take one of the steps above or wait a little bit for the official patch.

@bobbrow bobbrow added bug a bug in the product IMPORTANT regression used to work and no longer does. Regressions are typically high priority labels Apr 20, 2023
@bobbrow bobbrow added this to the 1.14 milestone Apr 20, 2023
@benmcmorran
Copy link
Member

The fix for this issue is included in version 1.14.30 of the extension, which is now available on the VS Code Marketplace. Thanks for your quick report and for your patience while we got a fix out, and please let us know if you're still seeing this issue on the new version.

@thirtytwobits
Copy link

Confirmed this is a fix! Thanks for the fast turn-around on this.

@FtZPetruska
Copy link
Author

It seems fixed for me too, thank you for the quick reaction!

@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product regression used to work and no longer does. Regressions are typically high priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants