0

它只是一个简单的“Hello World”程序,源代码:

package main

import "fmt"

func main() {
    fmt.Println("Hello, World")
}

我编译它,用

去版本 go1.10.3 gccgo (GCC) 8.3.0 linux/amd64

它报告了以下错误消息:

[victor@chroot-64:~/go]$ go build helloworld.go 
# command-line-arguments
/tmp/go-build724467564/b001/_buildid.s: Assembler messages:
/tmp/go-build724467564/b001/_buildid.s:1: Warning: entity size for SHF_MERGE not specified
/tmp/go-build724467564/b001/_buildid.s:1: Warning: group name for SHF_GROUP not specified
as: $WORK/b001/_buildid.o: warning: sh_link not set for section `.go.buildid'
# command-line-arguments
BFD: $WORK/b001/_buildid.o: warning: sh_link not set for section `.go.buildid'
# command-line-arguments
/usr/bin/ld: $WORK/b001/_pkg_.a(_buildid.o): warning: sh_link not set for section `.go.buildid'
/usr/bin/ld: unable to place orphaned sharable section .go.buildid (/tmp/go-build724467564/b001/_pkg_.a(_buildid.o))
collect2: error: ld returned 1 exit status
[victor@chroot-64:~/go]$

命令go env打印

[victor@chroot-64:~/go]$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/local"
GOTMPDIR=""
GOTOOLDIR="/usr/local/libexec/gcc/x86_64-pc-linux-gnu/8.3.0"
GCCGO="/usr/local/bin/gccgo8"
CC="gcc8"
CXX="g++8"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build455330439=/tmp/go-build -gno-record-gcc-switches -funwind-tables"
4

0 回答 0