-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
Behavior:
- Click "Run Test" button correctly run the rust unit tests
- Click "Debug" button does not spawn any process.
It gives the following error message on the bottom right
Cargo invocation has failed: Error: could not launch cargo: Error: spawn cargo ENOENT
Related settings:
- My rust toolchain is not installed in HOME, nor it is installed in any directory that requires root permission.
- Environment variables, such as
CARGO_HOME
,PATH
(which includes rustup and cargo),RUSTUP_HOME
are not set,
in~/.bashrc
,~/.bash_profile
, or~/.profile
So by default, in the terminal, there is nocargo
in the PATH. - Rust related env variables are set in the VSCode workspace settings as the following:
Actual Path omitted.
All settings ofCARGO_HOME
,PATH
andRUSTUP_HOME
are the same.
"rust-analyzer.runnableEnv": {
"CARGO_HOME": "...",
"PATH": "...",
"RUSTUP_HOME": "...",
},
"rust-analyzer.server.extraEnv": {
"CARGO_HOME": "...",
"PATH": "...",
"RUSTUP_HOME": "...",
},
"rust-analyzer.cargo.extraEnv": {
"CARGO_HOME": "...",
"PATH": "...",
"RUSTUP_HOME": "...",
},
"rust-analyzer.check.extraEnv": {
"CARGO_HOME": "...",
"PATH": "...",
"RUSTUP_HOME": "...",
},
"rust-analyzer.debug.engine": "ms-vscode.cpptools",
"rust-analyzer.debug.engineSettings": {
"cppdbg": {
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"environment": [
{
"name": "CARGO_HOME",
"value": "...",
},
{
"name": "PATH"
"value": "...",
}
{
"name": "RUSTUP_HOME"
"value": "...",
}
],
}
- Removing the "environment" settings in "rust-analyzer.debug.engineSettings" does NOT fix the problem.
- Set those environment variables directly in
~/.bashrc
, kill VSCode server, and relaunch VSCode SOLVES the problem.
But I do not want to use this way to solve the issue.
I do not want rust related stuffs to pollute my~/.bashrc
, since only a small number of projects use it. - This should be a regression. My setup was working in an old version, around 3 months ago.
But I am not sure which old version.
rust-analyzer version (The version which has the bug):
rust-analyzer version: 0.3.1377-standalone
rustc version:
rustc 1.61.0 (fe5b13d68 2022-05-18)
Operating system:
CentOS Linux release 7.3.1611
rust-analyzer executable requires GLIBC 2.25,
while my environment uses GLIBC 2.17.
So the RPATH of rust-analyzer
executabl is modified to
point to a custom compiled GLIBC 2.30
Possible cause guested by me:
Is rust-analyzer.runnableEnv
really applied to Debug
?
Can you check if the PATH
has been applied?
nerdoc