Open dan-dragan opened 11 months ago
Since building dlv failed, this issue is different than https://github.com/aws/aws-toolkit-vscode/issues/3984 where build succeeded but attaching the debugger failed.
This also works:
sam local start-api --invoke-image artifactory.mydomain/sam/build-go1.x
That command doesn't install a debugger, which is the tricky part. We try to automate building and installing the Go dlv debugger: https://github.com/aws/aws-toolkit-vscode/blob/170588fcf4b6fb7d2a6eda7eed17262fbeb049f8/src/shared/sam/debugger/goSamDebug.ts#L238
but unfortunately it seems to be failing on your (arm64
) machine.
2023-12-08 16:26:20 [ERROR]: [Delve install script] -> # runtime/cgo
linux_syscall.c:67:13: error: call to undeclared function 'setresgid'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
linux_syscall.c:67:13: note: did you mean 'setregid'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:593:6: note: 'setregid' declared here
We attempt to cross-compile, but something went wrong. https://github.com/aws/aws-toolkit-vscode/blob/170588fcf4b6fb7d2a6eda7eed17262fbeb049f8/src/shared/sam/debugger/goSamDebug.ts#L31-L33
https://github.com/golang/go/issues/54695 mentions that we might need to set CC
to cross-compile from mac to linux, but that wasn't always needed, did something change?
If cross-compiling is unreliable, we may need to remove that feature and instead require that a correct dlv
build exists on the container.
@justinmk3 thanks for your comment. Since I work in a locked down, corporate environment, github.com and any external repositories are not available. go get will fail in my case. That's probably the cause. A solution that locates, copies and uses a delve already installed and working on the user's machine - at least an alternative solution - might be preferable for locked down corporate envs such as mine.
Problem
I am trying to locally debug a golang-based lambda. As I press the Run/Start Debugging menu, nothing happens for a while then a message pops up stating "Failed to install Delve for the lambda container."
I can start dlv from the command line.
This also works:
Steps to reproduce the issue
Expected behavior
The lambda should load and the breakpoints in code should be active.
System details
OS: Darwin arm64 22.6.0 Visual Studio Code extension host: 1.84.2 AWS Toolkit: 2.2.0 node: 18.15.0 electron: 25.9.2
template.yaml:
launch.json:
Logs: