Centos5.6 deployment golang environment encountered. make. bash: line141: 29239Segmentationfault "$ GOTOOLDIR" go_bootstrapclean-istd
1. deploy the golang environment in centos5.6 a few days ago. Encountered problems when executing the./all. bash script. I didn't care much at the time. Ignore it and continue the subsequent operations. After all the operations are completed, it is useless to find the problem. The environment is still not installed.
2. No reason was found at the time. It was put on hold for a few days. Redeploy today. By the way, I found the cause of the error that day. It was discovered that the error message caused the subsequent operations to be invalid.
3. the error message is:
./Make. bash: line 141: 29239 Segmentation fault "$ GOTOOLDIR"/go_bootstrap clean-I std
4. I have been searching for documents for a long time. I have crawled many sites. The materials on the official website are in English and cannot be understood. The same error message is displayed on a forum.
5. it turns out that the kernel version of centos5.6 is too low. Upgrade the kernel. Thanks to the previous document, the kernel upgrade cannot be started. The golang environment is successfully deployed.
6. after the kernel is upgraded, follow the steps below to successfully deploy the golang environment
Install Mercurial
Install the Mercurial version management system (you can output the hg term to check whether the version is installed) before performing subsequent operations ). Run the following command to install the SDK:
$ Yum install mercurial
Get Code
The following command creates a go directory. Switch to the corresponding directory and make sure the go directory does not exist at the current location. run the following command:
$ Hg clone-r release https://go.googlecode.com/hg/ go
Install Go
Compile the go environment:
$ Cd go/src
After $./all. bash is compiled, the following information is printed at the end. Installed Go for linux/amd64 in/home/you/go. installed commands in/home/you/go/bin. * ** You need to add/home/you/go/bin to your $ PATH. ***
Set $ PATH
$ Cd/etc/profile. d/
$ Vi go. sh
Export GOROOT =/home/you/go
Export GOBIN = $ GOROOT/bin export GOARCH = amd64 export GOOS = linux export PATH =.: $ PATH: $ GOBIN $ ../go. sh program
Take the hello. go code as an example and compile it with the following command:
Package main
Import "fmt"
Func main (){
Fmt. Printf ("hello world \ n ")
}
$ Go build hello. go
Run the program: $./hello
For how to manage compilation go projects, see https://golang.org/doc/code.html