delve: no such file or directory

已回答

I was following this guide here from the blog for creating docker targets.  I was able to get this working with the run functionality, but I am struggling to get the debugger to work.  

Whenever I run debug, it gets the following error: 

/tmp/6cef2cee-43fc-4527-b375-0e351dade291/dlv --listen=0.0.0.0:61352 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /tmp/d5bf5b49-9de0-4444-babf-fb7bafe2f34e/___1run_server_target_linux_docker_linux --
exec /tmp/6cef2cee-43fc-4527-b375-0e351dade291/dlv: no such file or director

It seems like GoLand tries to copy its own version of dlv into a temporary folder, which makes sense based on the documentation on additional settings when using run targets.

Does anyone know how I can debug this further?

 

0

Hello Brandon,

Can you share the Dockerfile configuration or a link to the project?

0

Hi Daniil, I posted up a quick goland project on https://github.com/bsnuggs1/remoteGoTest.  With this example, you should be able to see the same scenario where remote works if you use Run, but you get the "no such file or directory" when you try to use the Debugger.  

I also included the configurations that I used.

Thanks for looking into this!

0

Hello,

Will it work if you use golang image instead of golang-alpine?

Please see attached screenshot.

0

Thanks Daniil, that did the trick!  Admittedly, I am confused though...  I thought that the delve executable was transferred to the container, why is alpine usage a problem?  Also, the blog post, https://blog.jetbrains.com/go/2021/04/30/how-to-use-docker-to-compile-go-from-goland/, also uses alpine.

0

Hmm, perhaps I may have spoken too soon.  I noticed that this did indeed work for the simplified scenario, but when I tried using golang for the larger scenario, I get a different error where it seems that delve is timing out:

/tmp/fadc7f48-38c5-488e-b2a0-b82cec633e61/dlv --listen=0.0.0.0:53279 --headless=true --api-version=2 --check-go-version=false --only-same-user=false exec /tmp/26574b9f-f0e5-4389-a67b-9e60ce71a486/___run_server --
API server listening at: [::]:53279
2022-12-09T21:14:59Z warning layer=rpc Listening for remote connections (connections are not authenticated nor encrypted)

Debugger finished with the exit code 0

Goland will wait about 30 seconds before it gives up waiting for dlv.  I'm still investigating this, but I am curious if it has something to do with the dlv version.  As I understand, Goland 2022.3 uses Delve 1.9 and I'm curious about what happens if I force it to use 1.20 instead.

 

 

 

0

I get a different error where it seems that delve is timing out:

Is there a chance to share a reproducible example? Will it work in the same way with enabled Build on remote target option?

I thought that the delve executable was transferred to the container, why is alpine usage a problem?

Thanks for spotting that out! We will update the blog post because alpine is different than other Linux distributions. Delve nowadays requires libc6-compat library to use, but it is not included by default in the image.

So, you can add RUN apk add --no-cache libc6-compat entry in Dockerfile or use a non-alpine image.

0

I am having a similar issue trying to run my debugger on the latest Go image…

Go version: go version go1.21.6 linux/arm64
Goland version: GoLand 2023.3.2
OSX version: Sonoma 14.2.1 (23C71) [M2 chip]
Docker version: 25.0.0

Error from Goland: Error running 'go build bevm/cmd/server' Can't run process: java.util.concurrent.CompletionException: com.github.dockerjava.api.exception.DockerException: Status 400: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: \"/tmp/f27f7db7-d34d-4664-bd8f-82f7d21614f6/dlv\": stat /tmp/f27f7db7-d34d-4664-bd8f-82f7d21614f6/dlv: no such file or directory: unknow

0

Hi Himynameischaseiwearsocks, please share your Dockerfile.

0

请先登录再写评论。