Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support delve on Windows #1922

Closed
akevinbailey opened this issue Oct 16, 2015 · 22 comments
Closed

Support delve on Windows #1922

akevinbailey opened this issue Oct 16, 2015 · 22 comments
Assignees
Labels

Comments

@akevinbailey
Copy link

The debugger in not enabled on Windows even though I have MinGW-w64 and GDB.

@dlsniper
Copy link
Member

Does delve support mingw?

@akevinbailey
Copy link
Author

Not sure. Apparently the delve group is working on a windows port.

@dlsniper
Copy link
Member

Ok, then when delve will support Windows the plugin will support Windows as well. :)

@dlsniper dlsniper changed the title Debugger Not Enabled on Windows Support delve on Windows Oct 16, 2015
@ignatov
Copy link
Contributor

ignatov commented Oct 28, 2015

@kolkov
Copy link

kolkov commented Jan 24, 2016

Congratulations! Branches was merged today!
https://github.com/derekparker/delve/issues/198#issuecomment-174253735

@GameXG
Copy link

GameXG commented Jan 24, 2016

Also see.
go-lang-idea-plugin how to turn on debug function?

@kolkov
Copy link

kolkov commented Jan 24, 2016

fix!
Developers of the plugin start working for debug support on windows. Please waiting for test build from team!

@GameXG
Copy link

GameXG commented Jan 24, 2016

@kolkov Thank you very much.
Has successfully used debugging。

@ignatov
Copy link
Contributor

ignatov commented Jan 24, 2016

I'll be very appreciated if someone can provide a command line (or power shell script) for building Delve on Windows with Go distro downloading/unzipping, setting up GOPATH, etc.

@dlsniper
Copy link
Member

@ignatov if there's no script for this I'll try and provide it tomorrow.

@dlsniper
Copy link
Member

I've ran this against Windows Server 2012 r2 and Powershell. To run it open a powershell session and simply point the command to the file. It doesn't cleanup the installers but that's easy to add if needed.

Please let me know if there are any issues with this. Thank you.

# Install Go
if (-Not (Test-Path "C:\Go")) {
  echo "Installing Go"
  $file = "go1.5.3.windows-amd64.msi"
  $url  = "https://storage.googleapis.com/golang/"
  $url += $file
  Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file
  msiexec /package $file /quiet | Out-Null
} else {
  echo "Go already installed"
}

# Install 7Zip
if (-Not (Test-Path "C:\Program Files\7-Zip")) {
  echo "Installing 7Zip"

  $file = "7z1514-x64.msi"
  $url  = "http://7-zip.org/a/"
  $url += $file
  Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file
  msiexec /package $file /quiet | Out-Null
} else {
  echo "7Zip already installed"
}

# Install MinGW
if (-Not (Test-Path "C:\mingw64")) {
  echo "Installing MinGW"

  $file = "x86_64-4.9.2-release-win32-seh-rt_v4-rev3.7z"
  $url  = "https://bintray.com/artifact/download/drewwells/generic/"
  $url += $file
  Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file
  &"C:\Program Files\7-Zip\7z.exe" x -oC:\ $file > $null
} else {
  echo "MinGW is already installed"
}

# Install git
if (-Not (Test-Path "C:\Program Files\Git")) {
  $file = "Git-2.7.0-64-bit.exe"
  $url  = "https://github.com/git-for-windows/git/releases/download/v2.7.0.windows.1/"
  $url += $file
  Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file
  ./Git-2.7.0-64-bit.exe /SILENT /COMPONENTS="icons,ext\reg\shellhere,assoc,assoc_sh" | Out-Null
} else {
  echo "git is already installed"
}

if (-Not (Test-Path "C:\golang")) {
  mkdir "c:\golang"
}

$env:GOPATH="c:\golang"
$env:PATH="c:\Go\bin;c:\mingw64\bin;"+$env:GOPATH+"\bin;C:\Program Files\Git\bin;"+$env:PATH
echo $env:PATH
echo $env:GOPATH
go version
go env
go get github.com/tools/godep
go get -d github.com/derekparker/delve
cd $env:GOPATH\src\github.com\derekparker\delve
godep restore
mingw32-make install

@dlsniper
Copy link
Member

I've forgot to mention, this produces the dlv.exe binary under C:\golang\bin.

@ctd1500
Copy link

ctd1500 commented Jan 27, 2016

@dlsniper your script tries to install Git twice, but it installs Git during the MinGW step without checking for any existence first.

@kolkov
Copy link

kolkov commented Jan 27, 2016

I think you need to test GOPATH, not c:/Go only.

@dlsniper
Copy link
Member

@dlsniper your script tries to install Git twice, but it installs Git during the MinGW step without checking for any existence first.

@ctd1500 thanks, fixed!

I think you need to test GOPATH, not c:/Go only.

@kolkov I'm sorry but I don't understand this, please explain. Thank you.

@ctd1500
Copy link

ctd1500 commented Jan 27, 2016

I think you need to test GOPATH, not c:/Go only.

@dlsniper I think he means it should check if the GOPATH environment variable exists and to (Test-Path $env:GOPATH), before just making a new one. Maybe before trying to install Go as well.

@kolkov
Copy link

kolkov commented Jan 27, 2016

@dlsniper If I understood correctly, you want to know is Golang installed already?

# Install Go
if (-Not (Test-Path "C:\Go")) {
  echo "Installing Go"
  $file = "go1.5.3.windows-amd64.msi"
  $url  = "https://storage.googleapis.com/golang/"
  $url += $file
  Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file
  msiexec /package $file /quiet | Out-Null
} else {
  echo "Go already installed"
}

But path of the Golang may be different! Not only c:/go
When we check GOPATH and GOROOT, we will know that Goolang present and where Golang located.

@dlsniper
Copy link
Member

I see.

Until I have some information from @ignatov about the environment where this will run I won't make any changes to it.

The script is meant to be used on a blank, CI(?), server.

If someone wants to improve it to make it an universal solution for installing Go, MinGW and then other tools, then please please feel free to do so.

@ignatov
Copy link
Contributor

ignatov commented Jan 27, 2016

Hi, thanks for your script!
I suppose that will be better to setup all stuff that you need to the current (working) directory.
This is my script for Linux:

set -x
set -e

mkdir -p gopath
wget -c -N https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gz
tar xfvz go1.5.1.linux-amd64.tar.gz 

export GOROOT=$(pwd)/go/
export GOPATH=$(pwd)/gopath
export PATH=$(pwd)/go/bin:$PATH
which go
go get -u -v github.com/derekparker/delve/cmd/dlv
strip $GOPATH/bin/dlv

@dlsniper
Copy link
Member

Ok, I'll make the changes tonight.
Btw, can you please make a small change to the script for linux / osx so that it adds the commit hash to the version info? To do so it would need to run:

go install -ldflags="-X main.Build=$(cd $GOPATH/src/github.com/derekparker/delve && git rev-parse HEAD)" github.com/derekparker/delve/cmd/dlv

Thank you.

@dlsniper
Copy link
Member

Here's an updated version: https://gist.github.com/dlsniper/6027dba0291f1287f3f4

@ignatov
Copy link
Contributor

ignatov commented Feb 6, 2016

Hi all, please try the latest nightly build (0.10.1119 or higher) on Windows and tell how it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants