Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Debug unit test code lens fails with a cargo linking failure #887

Closed
@adaszko

Description

@adaszko

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

I actually know what the source of the problem is: 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.

It looks like this is caused by #373 and #5.

Is this env and preLaunchTask config items handling simply not implemented yet?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions