Open hwhsu1231 opened 7 months ago
@hwhsu1231 To confirm, there is no way to repro this on the command-line? It seems like if the issue is related to the .bashrc
files, then I would expect that it doesn't have to do with the CMake Tools extension.
@hwhsu1231 However, it could have to do with our interpretation of the PATH variable while parsing the presets. I see you are using the pre-release version (THANK YOU!), does this also happen on the official release version (1.17.17). Thanks.
Also, if possible, please provide your repro project, if it has anything to do with presets interpretation, we will need that in order to investigate.
Hello, @gcampbell-msft
To confirm, there is no way to repro this on the command-line?
That is correct. I haven't reproduced this on the command-line currently, and it only happened to CMake Tools.
Also, if possible, please provide your repro project, if it has anything to do with presets interpretation, we will need that in order to investigate.
I already provided the repro/demo project, demo-cmake-tools-bashrc, at the first comment. And it's already published to GitHub, so you can clone it to investigate.
I see you are using the pre-release version (THANK YOU!), does this also happen on the official release version (1.17.17). Thanks.
Yes. It does. I switched to 1.17.17, and rebooted after this phenomenon finally happened. As we can see, rebooting can definitely solve this issue.
@hwhsu1231 @gcampbell-msft, thanks for providing the demo project. Today we verified this issue with below environment and repro steps. If we miss or misunderstand anything, please let us know. Thanks. ENV:
System info: Ubuntu 22.04.4 LTS
VS code version: 1.88.1
CMake Extension version: v 1.17.17& v 1.88.28 pre-release
Install Node
Repro steps: 1.Open the project folder with VSCode.
Actual Results: Could find the Node package.
Hello, @Evelyn-001
If we miss or misunderstand anything, please let us know.
There's something you indeed misunderstand. It seems that the Node.js you installed is through apt install
because I saw your output of which node
command is:
/usr/bin/node
But the Node.js I installed in the demo is through nvm. Therefore, the output of which node
command is:
/home/hwhsu1231/.nvm/versions/node/v20.12.1/bin/node
If you install Node.js through nvm successfully, you should see the following contents in your .bashrc
:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
And that is why node
can be found if the .bashrc
is sourced correctly.
@hwhsu1231 @gcampbell-msft, thanks for your reply. Today we installed Node.js using the method you mentioned in abopve comment, but we still didn't repro this issue with below steps: ENV:
System info: Ubuntu 22.04.4 LTS
VS code version: 1.88.1
CMake Extension version: v 1.17.17& v 1.88.29 pre-release
Install Node using the method the customer mentioned.
Repro steps: 1.Open the project folder with VSCode.
Actual Results: Could find the Node package.
Hello, @Evelyn-001
Can you please try a few more times to see what happens? This issue occurs sporadically, so I can't precisely pinpoint how to reproduce it.
Note: In fact, the phenomenon occurred again while I was writing this response. However, this time, closing all windows and restarting VSCode resolved the issue. I suspect that the "software update" may be the cause. For example:
@hwhsu1231 @gcampbell-msft, thanks for your reply. Sorry we tried to reproduce this issue many times but still don't reproduce it. Could you please install VS code on another clean machine or reinstall VS Code to verify this issue again? Thanks a lot.
Hello, @Evelyn-001
Besides CMake: Log Diagnostics
and "cmake.loggingLevel": "debug"
, what other useful information can I provide for investigation (when the issue occurs)?"
Could you please install VS code on another clean machine or reinstall VS Code to verify this issue again? Thanks a lot.
BTW, my VSCode is installed by Snap. Here are some information about it:
hwhsu1231@vb-kubuntu:~$ snap list code
Name Version Rev Tracking Publisher Notes
code e170252f 157 latest/stable vscode✓ classic
hwhsu1231@vb-kubuntu:~$ snap info code
name: code
summary: Code editing. Redefined.
publisher: Visual Studio Code (vscode✓)
store-url: https://snapcraft.io/code
contact: https://twitter.com/code
license: unset
description: |
Visual Studio Code is a new choice of tool that combines the
simplicity of a code editor with what developers need for the core
edit-build-debug cycle.
commands:
- code
- code.url-handler
snap-id: Ht0aUHi7ofh9Fbwh6m7jUN2pAy6kzBiu
tracking: latest/stable
refresh-date: 5 days ago, at 13:51 CST
channels:
latest/stable: e170252f 2024-04-11 (157) 326MB classic
latest/candidate: ↑
latest/beta: ↑
latest/edge: ↑
installed: e170252f (157) 326MB classic
hwhsu1231@vb-kubuntu:~$
@gcampbell-msft, we still don't repro this issue on our environment. what other useful information can customer provide for investigation (when the issue occurs)?" Thanks in advance.
@hwhsu1231 @Evelyn-001 Unfortunately this seems to be a difficult problem to reproduce in general. Either way, from all of your screenshots, this seems to be an issue of opening VS Code with the right environment, not so much a bug with CMake Tools.
When this problem reproduces, are you able to, on the terminal command-line, ignoring the CMake Tools extension, print out the environment variable and see what the values are normally vs in the repro?
When this problem reproduces, are you able to, on the terminal command-line, ignoring the CMake Tools extension, print out the environment variable and see what the values are normally vs in the repro?
@gcampbell-msft Sure. But I have some questions to ask:
env
command?env
command printed in the normal vs in the repro?env
command for the PATH
variable. Thanks!
@gcampbell-msft
To print the output of the env
command, I comitted this change:
However, I don't think this issue is related to VSCode (Maybe I'm wrong~). It's because when I first tried to test if there was a problem, I actually conducted the test on VSCode's "Integrated Terminal". The results, as I posted in my 1st comment, were successful in identifying those third-party tools.
BTW, as I write this comment, the issue has finally reoccurred. Below are the log outputs and screenshots from my tests. This time, I tested three scenarios:
The results show that only the output from the CMake Tools extensions failed to find those third-party tools.
LOG-20240502-cmt-extension.txt LOG-20240502-vsc-terminal.txt LOG-20240502-konsole.txt
@gcampbell-msft
The following is the debug log printed in CMake/Build
output panel when reopenning the project folder in vscode:
But unfortunately, this reopenning didn't fix the issue. The following is the debug log of the subsequent CMake: Delete Cache and Reconfigure
run:
Is this information helpful?
Hello, @gcampbell-msft and CMake Tools Team.
Can you try install the snap version of CMake:
sudo snap install cmake --classic
and then run the follwoing command to create a symbolic link:
sudo ln -s /snap/cmake/current/bin/cmake /usr/bin/cmake
and try again to see whether the phenomenon happens?
This is the way I fix the snap of cmake issue of cmake-tools https://github.com/microsoft/vscode-cmake-tools/issues/838#issuecomment-1871993525. Maybe it's related to this issue.
@hwhsu1231, thanks for your reply. the snap version of CMake we have always installed. And we run the above command to create a symbolic link, but we still don't repro this issue, please see the below screenshots. Thanks. @gcampbell-msft FYI
I'm facing the same issue, with some additional edge cases:
Restarting VSCode or the system doesn't solve the problem.
ENV:
System info: Ubuntu 22.04.4 LTS
VS code version: 1.91.1
CMake Extension version: 1.18.43
@fpanjevic, thanks for your reply. Are your steps to reproduce the problem the same as hwhsu1231's? If not, please provide your detailed steps to reproduce the problem for further investigation. We are looking forward to hearing from you. Thanks.
Brief Issue Summary
Recently, I tried to use
find_program
to find some 3rd-party tools installed on my Kubuntu 22.04 system. For example:However, I found that sometimes cmake-tools cannot find those tools due to the incorrect value of
$PATH
.Click to expand the full log
``` [main] Configuring project: demo-cmake-tools-bashrc [proc] Executing command: /usr/bin/cmake -S/home/hwhsu1231/Repo/testing/demo-cmake-tools-bashrc -B/home/hwhsu1231/Repo/testing/demo-cmake-tools-bashrc/out/build/default [cmake] -- ---------------------------------------- [cmake] -- JEKYLL_EXECUTABLE = JEKYLL_EXECUTABLE-NOTFOUND [cmake] -- NODE_EXECUTABLE = NODE_EXECUTABLE-NOTFOUND [cmake] -- PO4A_EXECUTABLE = PO4A_EXECUTABLE-NOTFOUND [cmake] -- MDBOOK_EXECUTABLE = MDBOOK_EXECUTABLE-NOTFOUND [cmake] -- CROWDIN_EXECUTABLE = CROWDIN_EXECUTABLE-NOTFOUND [cmake] -- ENV{SHELL} = /bin/bash [cmake] -- ENV{BASH_VERSION} = [cmake] -- ENV{PATH} = /home/hwhsu1231/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/hwhsu1231/.local/share/JetBrains/Toolbox/scripts [cmake] -- File "/home/hwhsu1231/.bashrc" exists. [cmake] -- ---------------------------------------- [cmake] -- Configuring done (0.0s) [cmake] -- Generating done (0.0s) [cmake] -- Build files have been written to: /home/hwhsu1231/Repo/testing/demo-cmake-tools-bashrc/out/build/default ```As we can see, those tools cannot be found by
find_program()
due to theENV{PATH}
.But it is working when I configuring the cmake project directly on the command-line:
Click to expand the full log
```bash hwhsu1231@vb-kubuntu:~/Repo/testing/demo-cmake-tools-bashrc$ cmake --preset default -- ---------------------------------------- -- JEKYLL_EXECUTABLE = /home/hwhsu1231/gems/bin/jekyll -- NODE_EXECUTABLE = /home/hwhsu1231/.nvm/versions/node/v20.12.1/bin/node -- PO4A_EXECUTABLE = /home/hwhsu1231/perl5/bin/po4a -- MDBOOK_EXECUTABLE = /home/hwhsu1231/.cargo/bin/mdbook -- CROWDIN_EXECUTABLE = /home/hwhsu1231/.nvm/versions/node/v20.12.1/bin/crowdin -- ENV{SHELL} = /bin/bash -- ENV{BASH_VERSION} = -- ENV{PATH} = /home/hwhsu1231/.nvm/versions/node/v20.12.1/bin:/home/hwhsu1231/perl5/bin:/home/hwhsu1231/.cargo/bin:/home/hwhsu1231/gems/bin:/home/hwhsu1231/gems/bin:/home/hwhsu1231/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/hwhsu1231/.local/share/JetBrains/Toolbox/scripts -- File "/home/hwhsu1231/.bashrc" exists. -- ---------------------------------------- -- Configuring done (0.0s) -- Generating done (0.0s) -- Build files have been written to: /home/hwhsu1231/Repo/testing/demo-cmake-tools-bashrc/out/build/default hwhsu1231@vb-kubuntu:~/Repo/testing/demo-cmake-tools-bashrc$ ```I can't tell how to reproduce this phenomenon exactly because it just happened randomly. (At least, I haven't found the step yet.)
After testing several times, I can be certain of the following points:
.bashrc
since the environments of those 3rd-party tools are configured by.bashrc
.You can see the demo project here: demo-cmake-tools-bashrc
CMake Tools Diagnostics
Debug Log
Additional Information
my-bashrc-and-profile.zip