Installation Method
For the installation method, see urlhttp: // golang.org/doc/install/gccgo
- Get the code documentation or something on SVN:
svn://gcc.gnu.org/svn/gcc/branches/gccgo
Go to the folder and run the configure command. Note that the latest GCC installation requires some compilation dependencies, for the installation of these compilation dependencies, refer to another article by the author that supports the installation of C ++ 0x GCC.
Some compilation options are required for configure execution. The specific meanings of these options can be obtained through -- help. The parameters used by the author are:
./configure --prefix=$HOME --enable-languages=c,c++,go --with-arch-32=i586
Then make & make install
We recommend that you use make in the background. This is definitely a long wait...
Then let's get it done. Write a simple hello World:
# Helloword. Go package main import "FMT" func main () {FMT. println ("Hello, go world ")}
- Then compile and link
$ gccgo -c helloWord.go $ gccgo -o hello helloWord.o
- Run the hello file. OK. Welcome to go !~
A problem occurred when installing the program according to the above method. The executable program of go is not installed, so it cannot be a good go install...
So I tried again:
- Go to the libgo folder and run./configure -- prefix = $ home -- enable-sjlj-exceptions -- enable-multilib = No -- without-libffi.
- Then modify CC in makefile to gccgo (the premise is that the above installation is OK, that is, the gccgo installation is successful) and execute make. Then wait, because-O2 is optimized, and the compilation speed is a little slow.
- Make install
Then, the tragedy found that the go command is still unavailable... Can only be compiled with gccgo... Go to the Internet to find another document, the above need to use Hg clone-u release https://go.googlecode.com/hg/ go this unreliable, brother again to find, you can use the following path to download: Pull. Then it's easy. Set the environment variable and go to sh./All. Sh in SRC to clean up the world ~ P.s. Later looked for information on the Internet and found that gccgo and go are both usable...
What makes me feel like this? So use both of them...
Some language features of go will be updated in the future.