Open
Description
Hi 👋
When I click the "Debug" code lens over a unit test, it fails with a linking error:
error: linking with `cc` failed: exit code: 1
[...]
= note: /usr/bin/ld: cannot find -lpython3.6m
collect2: error: ld returned 1 exit status
The source of the problem is this: The PATH
environment variable needs to include the /opt/miniconda/bin
directory. The problem is, even when I put in the env
section in launch.json
, it's seems like it's not being respected because it doesn't fix the problem:
{
"type": "lldb",
"request": "launch",
"name": "Debug benchmark 'bench_main'",
"env": {
"PATH": ".:/root/.cargo/bin:/opt/miniconda/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin"
},
"cargo": {
"args": [
"test",
"--no-run",
"--bench=bench_main",
"--package=ddx"
],
"filter": {
"name": "bench_main",
"kind": "bench"
}
},
"args": [],
"cwd": "${workspaceFolder}"
}
OTOH, if I build the code via this launch configuration:
{
"type": "cargo",
"command": "build",
"env": {
"PATH": ".:/root/.cargo/bin:/opt/miniconda/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin"
},
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "rust: cargo build"
}
there isn't any linking problem and the code builds fine. So I thought I could use the preLaunchTask
in launch.json
:
"preLaunchTask": "rust: cargo build",
but it also is being ignored and doesn't address the linking problem.