vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

env in presets not work and cmake.cmakePath not work

Open vipcxj opened this issue 11 months ago • 7 comments

Brief Issue Summary

This problem happened in the last few days.

  1. cmake.cmakePath is not working, causing the configuration to fail. I found that the original value was cmake and that it was fine before. I could also get the result by typing cmake --version directly in the terminal. However, to fix the problem, I changed it to the absolute path of cmake, and the problem was temporarily solved
  2. I set a customized cacheVariable in CMakePresets.json, "CMAKE_TOOLCHAIN_FILE":"$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", However, according to the output window, "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" is resolved to "/env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", which leads to configuration failure. But I tried it in the terminal and the environment variable VCPKG_ROOT was configured correctly. For this I tried restarting vscode, restarting vscode-server, both no effect

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.96.2",
  "cmtVersion": "1.19.52",
  "configurations": [
    {
      "folder": "/home/ps/workspace/projects/company/ai-server-cpp",
      "cmakeVersion": "3.29.6",
      "configured": true,
      "generator": "",
      "usesPresets": true,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] 正在配置项目: ai-server-cpp 
[main] 在配置/生成前保存打开的文件
[driver] 开始配置 
[driver] 正在运行预配置检查和步骤
[driver] 注意: 你正在使用预设 release 进行配置,但正在从 VS Code 设置中应用一些替代。
[cmakefileapi-driver] Configuring using preset
[cmakefileapi-driver] Invoking CMake /home/ps/workspace/cmake/bin/cmake with arguments ["-DCMAKE_BUILD_TYPE=RelWithDebInfo","-DGSTREAMER_SUPPORT=ON","-DUSE_GSTREAMER_FULL_STATIC=ON","-DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake","-DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-11","-Donnxruntime_TENSORRT_HOME=/usr","-S/home/ps/workspace/projects/company/ai-server-cpp","-B/home/ps/workspace/projects/company/ai-server-cpp/build"]
[proc] 执行命令: /home/ps/workspace/cmake/bin/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGSTREAMER_SUPPORT=ON -DUSE_GSTREAMER_FULL_STATIC=ON -DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-11 -Donnxruntime_TENSORRT_HOME=/usr -S/home/ps/workspace/projects/company/ai-server-cpp -B/home/ps/workspace/projects/company/ai-server-cpp/build
[proc]   环境为 {"LANGUAGE":"en_US:en","USER":"ps","SSH_CLIENT":"192.168.1.4 65173 22","LC_TIME":"zh_CN.UTF-8","XDG_SESSION_TYPE":"tty","SHLVL":"0","MOTD_SHOWN":"pam","HOME":"/home/ps","LC_MONETARY":"zh_CN.UTF-8","SSL_CERT_FILE":"/usr/lib/ssl/certs/ca-certificates.crt","DBUS_SESSION_BUS_ADDRESS":"unix:path=/run/user/1000/bus","LOGNAME":"ps","_":"/home/ps/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/server/node","XDG_SESSION_CLASS":"user","XDG_SESSION_ID":"1735","VSCODE_CLI_REQUIRE_TOKEN":"a762151c-104d-45d1-9c41-1163252dd246","PATH":"/home/ps/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/server/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ps/.dotnet/tools","VSCODE_AGENT_FOLDER":"/home/ps/.vscode-server","LC_ADDRESS":"zh_CN.UTF-8","XDG_RUNTIME_DIR":"/run/user/1000","SSL_CERT_DIR":"/usr/lib/ssl/certs","LANG":"en_US.UTF-8","LC_TELEPHONE":"zh_CN.UTF-8","SHELL":"/bin/bash","LC_NAME":"zh_CN.UTF-8","LC_MEASUREMENT":"zh_CN.UTF-8","LC_IDENTIFICATION":"zh_CN.UTF-8","PWD":"/home/ps","SSH_CONNECTION":"192.168.1.4 65173 192.168.1.233 22","LC_NUMERIC":"zh_CN.UTF-8","LC_PAPER":"zh_CN.UTF-8","VSCODE_CWD":"/home/ps","VSCODE_NLS_CONFIG":"{\"userLocale\":\"zh-cn\",\"osLocale\":\"zh-cn\",\"resolvedLanguage\":\"zh-cn\",\"defaultMessagesFile\":\"/home/ps/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/server/out/nls.messages.json\",\"languagePack\":{\"translationsConfigFile\":\"/home/ps/.vscode-server/data/clp/6d6cd612ec0ae3cd32737a6f6b7ad966.zh-cn/tcf.json\",\"messagesFile\":\"/home/ps/.vscode-server/data/clp/6d6cd612ec0ae3cd32737a6f6b7ad966.zh-cn/fabdb6a30b49f79a7aba0f2ad9df9b399473380f/nls.messages.json\",\"corruptMarkerFile\":\"/home/ps/.vscode-server/data/clp/6d6cd612ec0ae3cd32737a6f6b7ad966.zh-cn/corrupted.info\"},\"locale\":\"zh-cn\",\"availableLanguages\":{\"*\":\"zh-cn\"},\"_languagePackId\":\"6d6cd612ec0ae3cd32737a6f6b7ad966.zh-cn\",\"_languagePackSupport\":true,\"_translationsConfigFile\":\"/home/ps/.vscode-server/data/clp/6d6cd612ec0ae3cd32737a6f6b7ad966.zh-cn/tcf.json\",\"_cacheRoot\":\"/home/ps/.vscode-server/data/clp/6d6cd612ec0ae3cd32737a6f6b7ad966.zh-cn\",\"_resolvedLanguagePackCoreLocation\":\"/home/ps/.vscode-server/data/clp/6d6cd612ec0ae3cd32737a6f6b7ad966.zh-cn/fabdb6a30b49f79a7aba0f2ad9df9b399473380f\",\"_corruptedFile\":\"/home/ps/.vscode-server/data/clp/6d6cd612ec0ae3cd32737a6f6b7ad966.zh-cn/corrupted.info\"}","VSCODE_HANDLES_SIGPIPE":"true","DM_HOME":"/home/ps/workspace/dameng/unoffical/package","DOTNET_BUNDLE_EXTRACT_BASE_DIR":"/home/ps/.cache/dotnet_bundle_extract","LD_LIBRARY_PATH":":/home/ps/workspace/dameng/unoffical/package/bin","XDG_DATA_DIRS":"/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop","VSCODE_ESM_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","BROWSER":"/home/ps/.vscode-server/cli/servers/Stable-fabdb6a30b49f79a7aba0f2ad9df9b399473380f/server/bin/helpers/browser.sh","ELECTRON_RUN_AS_NODE":"1","VSCODE_IPC_HOOK_CLI":"/run/user/1000/vscode-ipc-00864071-5b1f-411a-bc63-fe4a433ec84d.sock","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","VSCODE_DOTNET_INSTALL_TOOL_ORIGINAL_HOME":"/home/ps","NODE_TLS_REJECT_UNAUTHORIZED":"0","VSCODE_L10N_BUNDLE_LOCATION":"vscode-local:/c%3A/Users/cxj/.vscode/extensions/ms-ceintl.vscode-language-pack-zh-hans-1.96.2024121109/translations/extensions/vscode.json-language-features.i18n.json","TRT_ROOT":"/home/ps/workspace/tensorrt/TensorRT-8.6.1.6","VCPKG_ROOT":"/home/ps/workspace/projects/vcpkg","http_proxy":"http://192.168.1.4:7890","https_proxy":"http://192.168.1.4:7890"}
[cmake] CMake Error at /home/ps/workspace/cmake/share/cmake-3.29/Modules/CMakeDetermineSystem.cmake:152 (message):
[cmake]   Could not find toolchain file: /scripts/buildsystems/vcpkg.cmake
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:2 (project)
[cmake] 
[cmake] 
[cmake] CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
[cmake] CMake Error: CMAKE_CUDA_COMPILER not set, after EnableLanguage
[cmake] CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
[cmake] CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
[cmake] -- Configuring incomplete, errors occurred!
[proc] 命令“/home/ps/workspace/cmake/bin/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGSTREAMER_SUPPORT=ON -DUSE_GSTREAMER_FULL_STATIC=ON -DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-11 -Donnxruntime_TENSORRT_HOME=/usr -S/home/ps/workspace/projects/company/ai-server-cpp -B/home/ps/workspace/projects/company/ai-server-cpp/build”已退出,代码为 1
[extension] [3327] cmake.configure 已完成(已返回 1)

Additional Information

From the Debug log you can see that vscode does get the value of the environment variable VCPKG_ROOT, so I think this should be the bug

vipcxj avatar Dec 25 '24 09:12 vipcxj

Given that the environment variable doesn't work, I temporarily replaced it with a defined value, and then it still failed to configure.

[cmake] -- The CUDA compiler identification is unknown
[cmake] CMake Error at /home/ps/workspace/cmake/share/cmake-3.29/Modules/CMakeDetermineCUDACompiler.cmake:266 (message):
[cmake]   Failed to detect a default CUDA architecture.
[cmake] 
[cmake] 
[cmake] 
[cmake]   Compiler output:
[cmake] 
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:2 (project)
[cmake] 
[cmake] 
[cmake] CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
[cmake] CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
[cmake] -- Configuring incomplete, errors occurred!
[proc] 命令“/home/ps/workspace/cmake/bin/cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DGSTREAMER_SUPPORT=ON -DUSE_GSTREAMER_FULL_STATIC=ON -DCMAKE_TOOLCHAIN_FILE=/home/ps/workspace/projects/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_CUDA_HOST_COMPILER=/usr/bin/g++-11 -Donnxruntime_TENSORRT_HOME=/usr -S/home/ps/workspace/projects/company/ai-server-cpp -B/home/ps/workspace/projects/company/ai-server-cpp/build”已退出,代码为 1
[extension] [6236] cmake.configure 已完成(已返回 1)

I have a feeling that cmake tools is completely broken, and even if you back off and temporarily fix one problem, you'll still be faced with the next one

vipcxj avatar Dec 25 '24 10:12 vipcxj

@vipcxj Thank you for your github issue! We would like to reproduce your issue, could you give us a repro steps?

Yingzi1234 avatar Dec 27 '24 07:12 Yingzi1234

@vipcxj Does this reproduce in the most recent pre-release version of the extension?

gcampbell-msft avatar Jan 06 '25 15:01 gcampbell-msft

As a contingency, I've changed all relative paths to absolute ones, but I've realized that my other problem may be due to the same cause #13124

vipcxj avatar Jan 07 '25 09:01 vipcxj

@vipcxj Following up on whether the issue reproduces in the most recent pre-release version?

gcampbell-msft avatar Jan 07 '25 14:01 gcampbell-msft

Still facing the same issue as of 1.100.2, it breaks the vcpkg getting started docs provided by Microsoft when using vscode.. incredibly frustrating experience so far.

Hoernchen avatar May 23 '25 22:05 Hoernchen

@Hoernchen Thank you for your info!

  1. 1.100.2 is recent VS Code version, if your issue is for VS code, please file new issue here: https://github.com/microsoft/vscode/issues

  2. If it's for CMake Tools, please verify issue on recent CMake Tools pre-release version 1.21.28.

  3. If you are still facing the issue on recent CMake Tools pre-release version, please send us the detailed repro steps and simple demo project. Thanks for your support!

Amy-Li03 avatar May 26 '25 07:05 Amy-Li03