|
我是在一代派上编译的Go,yum install golang也可以安装龙芯官方的go1.9,但是不能build。我就删除了官方源的go,按照龙芯开源社区官方的龙芯Go!Go!Go!——龙芯平台上构建Go语言环境指南的做法自举编译Go http://www.loongnix.org/index.php/%E6%96%87%E7%AB%A0/loongson-go
我的x86本本上是deepin 15.10
在x86机子上下载go1.4.2.linux-amd64.tar.gz go1.12.5.src.tar.gz
sudo tar zxvf go1.12.5.src.tar.gz -C /opt/golang/
susudo passwd rootsu
export GOROOT_BOOTSTRAP=/opt/go1.4.2
设置GOROOT_BOOTSTRAP 以后编译总是报错,说要root路径下的1.4.
我这边干脆把opt下的1.4.2mv到root路径下
mv /opt/go1.4.2 /root/
cd /opt/golang/go/src
GOOS=linux GOARCH=mips64le ./bootstrap.bash
如果遇到失败的情况则rm -rf ../../go-linux-mips64le-bootstrap (执行./bootstrap.bash会在上二级路径下生成我们要的go-linux-mips64le-bootstrap)
然后按照http://www.loongnix.org/index.php/%E6%96%87%E7%AB%A0/loongson-go的第二阶段:在龙芯平台上从源代码构建Go 1.6开发环境。的做法继续。
把go-linux-mips64le-bootstrap.tbz拷贝到派上,解压,然后mv到/root下,直接解压到/root/go1.4下
在派上我用的源码是 go1.12.4.src.tar.gz的
env.sh的shell脚本里面GO_TEST_TIMEOUT_SCALE的值我设为3,派用的高速U盘还是比龙芯台式机的磁盘io速度慢。
#!/bin/bash
export GOROOT_BOOTSTRAP=/root/go1.4
export GOROOT=/root/workspace/go
export GO_TEST_TIMEOUT_SCALE=3
先上图和编译记录
派开机后先清理内存,编译Go,很耗内存,清理内存以后一直到开始Testing packages不要再动内存了,但是不放心的话可以另开一个终端页面查看内存,测试完一项后会自动回收内存的,但是进行到 测试cmd/compile/internal/ssa的时候,我这边内存刚好耗光了,然后死机,其实这个时候可以耐心等待系统慢慢回复的,大概等了3分钟,go build cmd/compile/internal/ssa: /root/workspace/go/pkg/tool/linux_mips64le/compile: signal: killed
这个测试项kill掉了,开始测试下一个,内存也恢复到了1000多M.最后测试有一部分失败了,但是没关系,只要go编译好了就行。
go1.12.4 linux/mips64le
输出helloworld 我这里打成shijie了
这个地方
ok cmd/internal/obj 0.013s
ok cmd/internal/obj/arm64 0.073s
ok cmd/internal/obj/x86 52.163s
ok cmd/internal/objabi 0.023s
ok cmd/internal/src 0.014s
cmd/internal/obj是机器码生成的模块,这里x86和arm64机器码生成测试也能通过,福莱讲这个是检测编译器内部正确性,不执行,所以能通过,群里爱好编译器的也可以研究一下go是怎么写汇编程序的,在cmd/internal/obj里面,有x86,arm64,mips
编译过程,开机,打开终端
[root@192 src]# echo 3 > /proc/sys/vm/drop_caches,
[root@192 src]# free -m
total used free shared buff/cache available
Mem: 1780 191 1370 4 218 1550
Swap: 0 0 0
[root@192 src]# ./all.bash
Building Go cmd/dist using /root/go1.4.
Building Go toolchain1 using /root/go1.4.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/mips64le.
##### Testing packages.
ok archive/tar 0.287s
ok archive/zip 60.859s
ok bufio 0.656s
ok bytes 5.448s
ok compress/bzip2 0.454s
ok compress/flate 8.136s
ok compress/gzip 0.188s
ok compress/lzw 0.055s
ok compress/zlib 0.144s
ok container/heap 0.097s
ok container/list 0.021s
ok container/ring 0.103s
ok context 1.035s
ok crypto 0.021s
ok crypto/aes 0.236s
ok crypto/cipher 70.817s
ok crypto/des 0.073s
ok crypto/dsa 0.143s
ok crypto/ecdsa 13.224s
ok crypto/elliptic 0.289s
ok crypto/hmac 0.053s
ok crypto/internal/subtle 0.040s
ok crypto/md5 0.051s
ok crypto/rand 0.706s
ok crypto/rc4 0.379s
ok crypto/rsa 5.502s
ok crypto/sha1 0.262s
ok crypto/sha256 0.031s
ok crypto/sha512 0.049s
ok crypto/subtle 0.049s
ok crypto/tls 43.074s
ok crypto/x509 22.162s
ok database/sql 1.093s
ok database/sql/driver 0.056s
ok debug/dwarf 0.104s
ok debug/elf 0.183s
ok debug/gosym 0.067s
ok debug/macho 0.067s
ok debug/pe 0.074s
ok debug/plan9obj 0.023s
ok encoding/ascii85 0.068s
ok encoding/asn1 0.030s
ok encoding/base32 0.194s
ok encoding/base64 0.060s
ok encoding/binary 0.020s
ok encoding/csv 0.034s
ok encoding/gob 0.388s
ok encoding/hex 0.041s
ok encoding/json 5.240s
ok encoding/pem 0.110s
ok encoding/xml 0.179s
ok errors 0.031s
ok expvar 0.030s
ok flag 0.020s
ok fmt 0.785s
ok go/ast 0.030s
ok go/build 1.652s
ok go/constant 0.034s
ok go/doc 0.630s
ok go/format 0.116s
ok go/importer 0.849s
ok go/internal/gccgoimporter 0.135s
ok go/internal/gcimporter 1.949s
ok go/internal/srcimporter 11.140s
ok go/parser 0.228s
ok go/printer 2.748s
ok go/scanner 0.022s
ok go/token 0.165s
ok go/types 9.118s
ok hash 0.038s
ok hash/adler32 0.058s
ok hash/crc32 0.039s
ok hash/crc64 0.032s
ok hash/fnv 0.016s
ok html 0.041s
ok html/template 0.247s
ok image 0.738s
ok image/color 0.202s
ok image/draw 0.608s
ok image/gif 3.900s
ok image/jpeg 2.049s
ok image/png 0.273s
ok index/suffixarray 0.046s
ok internal/cpu 0.035s
ok internal/fmtsort 0.023s
ok internal/poll 0.196s
ok internal/singleflight 0.031s
ok internal/trace 16.799s
ok internal/x/crypto/chacha20poly1305 5.915s
ok internal/x/crypto/cryptobyte 0.021s
ok internal/x/crypto/curve25519 0.832s
ok internal/x/crypto/hkdf 0.032s
ok internal/x/crypto/internal/chacha20 0.634s
ok internal/x/crypto/poly1305 0.050s
ok internal/x/net/dns/dnsmessage 0.338s
ok internal/x/net/http/httpguts 0.025s
ok internal/x/net/http/httpproxy 0.051s
ok internal/x/net/http2/hpack 0.039s
ok internal/x/net/idna 0.022s
ok internal/x/net/nettest 1.899s
ok internal/x/text/transform 0.014s
ok internal/x/text/unicode/norm 0.030s
ok internal/xcoff 0.130s
ok io 0.061s
ok io/ioutil 0.029s
ok log 0.038s
ok log/syslog 1.296s
ok math 0.049s
ok math/big 27.634s
ok math/bits 0.030s
ok math/cmplx 0.021s
ok math/rand 1.994s
ok mime 0.068s
ok mime/multipart 28.372s
ok mime/quotedprintable 1.473s
ok net 28.835s
ok net/http 52.774s
ok net/http/cgi 1.941s
ok net/http/cookiejar 0.060s
ok net/http/fcgi 0.026s
ok net/http/httptest 2.346s
ok net/http/httptrace 0.023s
ok net/http/httputil 0.370s
ok net/http/internal 0.047s
ok net/http/pprof 2.052s
ok net/internal/socktest 0.082s
ok net/mail 0.032s
ok net/rpc 0.150s
ok net/rpc/jsonrpc 0.057s
ok net/smtp 0.315s
ok net/textproto 0.034s
ok net/url 0.049s
ok os 1.207s
ok os/exec 1.891s
ok os/signal 5.077s
ok os/user 0.045s
ok path 0.028s
ok path/filepath 0.266s
ok plugin 0.038s
ok reflect 1.612s
ok regexp 0.626s
ok regexp/syntax 4.767s
ok runtime 206.819s
ok runtime/debug 0.124s
ok runtime/internal/atomic 0.530s
ok runtime/internal/math 0.033s
ok runtime/internal/sys 0.023s
ok runtime/pprof 37.950s
ok runtime/pprof/internal/profile 0.016s
ok runtime/trace 21.794s
ok sort 1.125s
ok strconv 4.266s
ok strings 2.030s
ok sync 1.251s
ok sync/atomic 0.224s
ok syscall 31.362s
ok testing 1.338s
ok testing/quick 1.554s
ok text/scanner 0.039s
ok text/tabwriter 0.026s
ok text/template 3.998s
ok text/template/parse 0.142s
ok time 4.569s
ok unicode 0.020s
ok unicode/utf16 0.015s
ok unicode/utf8 0.037s
ok cmd/addr2line 23.246s
ok cmd/api 0.147s
ok cmd/asm/internal/asm 14.962s
ok cmd/asm/internal/lex 0.028s
ok cmd/compile 0.030s
ok cmd/compile/internal/gc 134.630s
go build cmd/compile/internal/ssa: /root/workspace/go/pkg/tool/linux_mips64le/compile: signal: killed
FAIL cmd/compile/internal/ssa [build failed]
ok cmd/compile/internal/syntax 0.149s
ok cmd/compile/internal/test 0.028s [no tests to run]
ok cmd/compile/internal/types 0.020s
ok cmd/cover 123.974s
ok cmd/doc 0.427s
ok cmd/fix 64.708s
ok cmd/go 119.989s
ok cmd/go/internal/cache 1.275s
ok cmd/go/internal/dirhash 0.041s
ok cmd/go/internal/generate 0.079s
ok cmd/go/internal/get 0.070s
ok cmd/go/internal/imports 0.062s
ok cmd/go/internal/load 0.045s
ok cmd/go/internal/lockedfile 0.045s
ok cmd/go/internal/lockedfile/internal/filelock 0.070s
ok cmd/go/internal/modconv 0.186s
ok cmd/go/internal/modfetch 0.066s
ok cmd/go/internal/modfetch/codehost 0.055s
ok cmd/go/internal/modfile 0.225s
ok cmd/go/internal/modload 0.120s
ok cmd/go/internal/module 0.030s
ok cmd/go/internal/mvs 0.046s
ok cmd/go/internal/par 0.147s
ok cmd/go/internal/search 0.021s
ok cmd/go/internal/semver 0.017s
ok cmd/go/internal/txtar 0.020s
ok cmd/go/internal/web2 0.069s
ok cmd/go/internal/work 0.191s
ok cmd/gofmt 0.523s
ok cmd/internal/buildid 3.324s
ok cmd/internal/dwarf 0.018s
ok cmd/internal/edit 0.021s
ok cmd/internal/goobj 10.696s
ok cmd/internal/obj 0.013s
ok cmd/internal/obj/arm64 0.073s
ok cmd/internal/obj/x86 52.163s
ok cmd/internal/objabi 0.023s
ok cmd/internal/src 0.014s
ok cmd/internal/test2json 1.657s
ok cmd/link 28.920s
ok cmd/link/internal/ld 52.848s
ok cmd/link/internal/sym 0.054s
ok cmd/nm 43.651s
ok cmd/objdump 8.178s
ok cmd/pack 16.409s
ok cmd/trace 0.087s
ok cmd/vendor/github.com/google/pprof/internal/binutils 0.790s
ok cmd/vendor/github.com/google/pprof/internal/driver 2.773s
ok cmd/vendor/github.com/google/pprof/internal/elfexec 0.014s
ok cmd/vendor/github.com/google/pprof/internal/graph 0.210s
ok cmd/vendor/github.com/google/pprof/internal/measurement 0.024s
ok cmd/vendor/github.com/google/pprof/internal/report 0.202s
ok cmd/vendor/github.com/google/pprof/internal/symbolizer 0.042s
ok cmd/vendor/github.com/google/pprof/internal/symbolz 0.030s
ok cmd/vendor/github.com/google/pprof/profile 0.726s
ok cmd/vendor/github.com/ianlancetaylor/demangle 0.313s
ok cmd/vendor/golang.org/x/arch/arm/armasm 0.236s
ok cmd/vendor/golang.org/x/arch/arm64/arm64asm 1.360s
ok cmd/vendor/golang.org/x/arch/ppc64/ppc64asm 0.220s
ok cmd/vendor/golang.org/x/arch/x86/x86asm 0.956s
ok cmd/vendor/golang.org/x/crypto/ssh/terminal 0.042s
ok cmd/vendor/golang.org/x/sys/unix 0.563s
ok cmd/vet 216.619s
2019/07/24 10:07:42 Failed: exit status 1
[root@192 src]# cd ..
[root@192 go]# cd bin/
[root@192 bin]# ls
go gofmt
[root@192 bin]# ./go version
go version go1.12.4 linux/mips64le
[root@192 bin]# vi ~/.bashrc
[root@192 bin]# source ~/.bashrc
[root@192 bin]# go version
go version go1.12.4 linux/mips64le
[root@192 bin]# cd ..
[root@192 go]# cd ..
[root@192 workspace]# ls
apue go1.4.src.tar.gz mpi.txt vmlinuz
apue.3e golang.txt pdf wget-log
apue.3e.src.tar go-linux-mips64le-bootstrap.tbz rtsp 新建文本.txt
go GoWorkspace test
go1.12.4.src.tar.gz hello.ko test.c
go1.4 ice.txt tftpserver
[root@192 workspace]# cd GoWorkspace/
[root@192 GoWorkspace]# ls
hello pkg
[root@192 GoWorkspace]# cd hello/
[root@192 hello]# ls
hello.go
[root@192 hello]# go build hello.go
[root@192 hello]# ls
hello hello.go
[root@192 hello]# ./hello
Hello,shijie
./hello
[root@192 hello]#
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|