delve: could not launch process on m1

could not launch process on m1

  1. What version of Delve are you using (dlv version)? Delve Debugger Version: 1.6.0 Build: 75485427957fba167a6eaca76b1ee9549d62916f
  2. What version of Go are you using? (go version)? go version go1.16beta1 darwin/arm64
  3. What operating system and processor architecture are you using? MacBook Air (M1, 2020) Big Sur 11.1
  4. What did you do? Try to run go application
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "showLog": true,
            "name": "app",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${workspaceFolder}",
            "cwd": "${workspaceFolder}/bin",
            "envFile": "${workspaceFolder}/.env",
        }
    ]
}
  1. What did you expect to see?
API server listening at: 127.0.0.1:20210
could not launch process: stub exited while waiting for connection: exit status 0
2021-01-29T14:50:43+03:00 info layer=debugger launching process with args: [.../__debug_bin]

But, if I run

CGO_ENABLED=0 arch -arch arm64 dlv debug --log --headless .

all fine. How I can launch dlv with arm64 mod by default ?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 22 (7 by maintainers)

Most upvoted comments

I only find this https://developer.apple.com/forums/thread/662738 But I can’t find, how I can run dlv with prefix arch -arch arm64 in VSCode

or setup arm64 by default with rosetta2

#!/bin/sh
exec /usr/bin/arch -arch arm64 /Users/eaglemoor/go/bin/dlv "$@"

@hyangah Thanks a lot !!!

Hi pwmcintyre

you are save my life. your step is good

  • sudo rm -rf /usr/local/go
  • sudo rm -rf /User/[xxxx]/go
  • then install go arm64
  • then install vscode arm64
  • setup terminal start with arm64 not using rosetta

Thanks

my problem was that i installed amd and not arm (URLs so similar!)

https://go.dev/dl/go1.17.5.darwin-amd64.pkg
https://go.dev/dl/go1.17.5.darwin-arm64.pkg

FIX:

i had to sudo remove my go dir (the installer didn’t do this properly):

  1. remove old
    sudo rm -rf ~/go
    
  2. install ARM go
  3. reload VS Code; and reinstall go tools
  4. success ✅

“API server listening at: 127.0.0.1:2826” - means dlv was found and launched and was running. “could not launch process” - means dlv was not able to launch the process.

@Jerry-yz You can use go.alternateTools setting. But now both Go and VS Code officially support M1, so you will not need this hack any further if you install the correct VS Code and the correct Go tool chain.

VS Code: https://code.visualstudio.com/download --> select “Universal” or “Apple Silicon” installer

Go: darwin-arm64 installer at https://golang.org/dl/go1.16.7.darwin-arm64.pkg