Google Go Installation procedure on Ubuntu 9.10 Karmic Koala

November 11th, 2009 by srinivas Leave a reply »

GO

This article helps you through the Installation procedure of Google GO on Ubuntu 9.10 Karmic Koala Operating System .

In my older posts on Talkonsomething ,I described about Google GO programming language feature and what new in Google GO .

Step 1 : In order to install Go compilation environment in Ubuntu 9.10 depends on the following environment variables which has to be set prior to Go installation .
—————————————————————————————————————————————

a. $GOROOT : Root of the Go tree , directory to check out the Go project .

  • Go to Terminal
  • Enter the following command
$ export  GOROOT=/home/your-name/hg

NOTE: Don’t create the directory hg , it will be automatically created when you  check out the code
—————————————————————————————————————————————

b. $GOOS : Name of the Operating System  , since we are using linux this environment variable has to be set with linux.

  • Go to Terminal
  • Enter the following command
$ export  GOOS=linux

—————————————————————————————————————————————

c.$GOARCH : Name of the target compilation architecture . if you are using

  • amd64 for AMD 64 bit processor
  • 386 (32-bit x86) Intel 32 bit process and
  • arm (32-bit ARM, an incomplete port)

Note: Based on your system configuration set the $GOARCH environment variable with the above list only the values which are bold ones. In my case its Inter 32 so the following will be my  $GOARCH environment  variable .

  • Go to Terminal
  • Enter the following command
$ export  GOARCH=386

—————————————————————————————————————————————
d.$GOBIN  : Specify any directory   in which the binaries files should be installed.  This specifies the path in which the GO compiler should be installed

  • Create a new create called bin  say  in /home/your-name/bin
  • Provide read ,write ,execute permission for  the bin directory  .
  • $ chmod 777  /home/your-name/bin
  • Set the $GOBIN path
  • $ export GOBIN=/home/your-name/bin
  • Also set the $GOBIN path in your $PATH with the following command
$ export PATH=$PATH:/home/your-name/bin
  • In order to check all the environment is set  type following command
             $ env|grep '^GO'
               GOBIN=/home/your-name/bin
               GOARCH=386
               GOROOT=/home/your-name/hg/
               GOOS=linux

This confirms all the environment variables are set perfectly you are ready for Installation of GO .
—————————————————————————————————————————————

Step 2 : Fetch the  GO Source files from the repository  using  Mercurial .

  • If Mercurial is not installed on your System , you can install it  with apt-get  command and also from the Ubuntu Synaptic package Manager.Mercurial
  •          $ sudo apt-get install mercurial
  • Fetch the Sources files with the following command it will create a folder called hg in the $GOROOT path and all the files will be cloned from the repository and will be installed in /home/your-name/hg directory
  •          $ hg clone -r release https://go.googlecode.com/hg/ $GOROOT
  • Here is the Snap Shots of the files and the commands once its is executed .
  • clone

  • Snap Shots of the files in /home/your-name/hg directory.
  • folders

—————————————————————————————————————————————
Step 3 : The Go tool chain is written in C. To build it, you need to have GCC, the standard C libraries, the parser generator Bison, and the text editor ed installed.

$ sudo apt-get install bison gcc libc6-dev ed

—————————————————————————————————————————————
Step 4 : In order to build the Go distribution on Ubuntu run the following commands in the terminal mode

  • Change directory  $GOROOT ie /home/your-name/hg  directory
  • $ cd $GOROOT/src
  • After changing it to the Source directory execute the following Command
  • $./all.bash
  • All the associated packages will be installed this will take some time be patient , if every thing goes well , you will get this message after execution
  • --- cd ../test
    N known bugs; 0 unexpected bugs

—————————————————————————————————————————————

Finally Now Google Go is Installed on your Ubuntu 9.10 OS . In my Next post i will explaining . How to write Hello World Example using Go if time permits .

Hope this helps ! , If you find it useful please Spread a word about Talkonsomething.com , you can also follow me on twitter here

“Open Source Rocks !!!!!”

—————————————————————————————————————————————

Related Posts with Thumbnails
Share this Article with your friends & colleagues using the below icons
  • Digg
  • Facebook
  • StumbleUpon
  • Reddit
  • del.icio.us
  • Mixx
  • DZone
  • Google Bookmarks
  • LinkedIn
  • Print
  • email
  • RSS

Related posts

  1. How to Install Google gccgo compiler in Ubuntu 9.10 Karmic Koala
  2. Installation guide for Novel’s Mono,Mono-develop,Xsp2 Server in Ubuntu 9.10 Karmic Koala
  3. Backing up and Restoring Ubuntu applications while upgrading from Ubuntu 9.04 to Ubuntu 9.10 Karmic Koala
  4. Installation Procedure for Rails Environment on Windows
  5. HOW TO RUN CRYSTAL REPORTS IN UBUNTU LINUX
Advertisement

9 comments

  1. Alex says:

    In the GOOS command you mistakenly wrote GOROOT=linux ;)

  2. meteor77 says:

    Thanks a lot. It has been very helpful to me.
    Just some precisions:

    for $GOROOT, it seems better like this:
    export GOROOT=/home/your-name/hg

    and for $GOOS, it is:
    export GOOS=linux

  3. srinivas says:

    @Alex @meteor77 Thanks for your comments , edited again accordingly .

  4. Hemant says:

    m having a problem with the final compilation,

    pls help…….

    this is the code snippet of the error:

    rm -f _test/path.a _gotest_.8
    make[2]: Leaving directory `/root/hg/src/pkg/path’
    make[2]: Entering directory `/root/hg/src/pkg/path’
    8g -o _gotest_.8 path.go path_test.go
    rm -f _test/path.a
    gopack grc _test/path.a _gotest_.8
    make[2]: Leaving directory `/root/hg/src/pkg/path’
    — FAIL: path.TestWalk
    1. error expected, none found
    node testdata/d/x mark = 2; expected 1
    node testdata/d/y mark = 2; expected 1
    node testdata/d/z mark = 2; expected 1
    node testdata/d/z/u mark = 2; expected 1
    node testdata/d/z/v mark = 2; expected 1
    FAIL
    make[1]: *** [test] Error 1
    make[1]: Leaving directory `/root/hg/src/pkg/path’
    make: *** [path.test] Error 2

Leave a Reply

Switch to our mobile site