Home / Go / Building Go from source on Windows edit

Pre-requisties:

In a cmd.exe (not PowerShell, because it screws things up):

  • checkout latest Go sources git checkout https://github.com/golang/go.git
  • cd go\src
  • add gcc to PATH by running c:\MinGW\set_distro_paths.bat
  • set GOROOT_BOOTSTRAP:
    • set GOROOT_BOOTSTRAP=C:\Go in cmd.exe
    • $env:GOROOT_BOOTSTRAP = "c:\Go" in powershell
  • all.bat : this builds Go and runs the tests

Running just runtime tests, in powershell:

  • $env:GOROOT = "C:\Users\kjk\src\go"
  • . "${env:GOROOT}\bin\go" test -c runtime
  • . "${env:GOROOT}\bin\go" test -c runtime -ldflags=-linkmode=external
  • $env:TEST_G0_STACK_OVERFLOW = "1"
  • gdb --args .\runtime.test.exe "-test.run" TestG0StackOverflow
  • .\runtime.test.exe "-test.run" TestRuntimePanic
  • In gdb:
    • br runtime.badmorestackg0

Go to index of articles.

Share on