Tuesday, December 8, 2009

Go on cygwin

I have a crap windows machine at my workplace and I wanted to do some work on Go during my free time. I had cygwin running and I could successfully install Google go on cygwin. So I thought I'll put this as a post.

You have to get the repository. But you wont have hg command installed(in most cases)
If you have already installed hg command for cygwin skip to step 2

1. Do the folowing commands
$ wget http://peak.telecommunity.com/dist/ez_setup.py
$ python ez_setup.py
$ easy_install -U mercurial
$ chmod +x /usr/lib/python2.5/site-packages/mercurial-1.0-py2.5-cygwin-1.5.25-i686.egg/mercurial/*.dll

2. Now that you have hg command on your machine. Do the following command.
$ hg clone https://golang-on-cygwin.googlecode.com/hg/ golang-on-cygwin

3. Now you have to setup certain environment variables.
export GOROOT=/path/to/golang-on-cygwin
export GOARCH=386
export GOOS=linux
export GOBIN=/path/to/your/local/bin
export PATH=$PATH:$GOBIN

4. Change to the source directory and run the all.bash script
cd $GOROOT/src
./all.bash

Installation will succeed and you can start with Google go

Thanks,
Layman

6 comments:

  1. When you say "you can start with Google go" does that mean you can type %> gccgo and it will work?
    Or does this only install the packages?

    ReplyDelete
  2. This will only install the packages

    ReplyDelete
  3. Hi,
    I keep getting this error, any ideas?
    /Erik

    %%%% making pkg %%%%
    ...

    rm -f _obj/runtime.a
    gopack grc _obj/runtime.a _go_.8

    ...

    make[1]: *** [/home/.../golang-on-cygwin//pkg/linux_386/runtime.a] Error 1
    rm reflect.c string.c sema.c malloc.c
    make[1]: Leaving directory `/home/.../golang-on-cygwin/src/pkg/runtime'
    make: *** [runtime.install] Error 2

    ReplyDelete
  4. Hi, I got this error

    mkenam: line 31: ed: command not found

    ReplyDelete
  5. Same here,
    31: ed: command not found

    ReplyDelete
  6. Install ed from cygwin setup.exe. Go to Editors and ed should be there.

    ReplyDelete