Closed
Description
What version of Go are you using (go version
)?
go version go1.11rc1 linux/amd64
Does this issue reproduce with the latest release?
Not sure
What operating system and processor architecture are you using (go env
)?
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/nqv/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/nqv/go"
GOPROXY=""
GORACE=""
GOROOT="/home/nqv/Downloads/go"
GOTMPDIR=""
GOTOOLDIR="/home/nqv/Downloads/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build126805613=/tmp/go-build -gno-record-gcc-switches"
What did you do?
Build a minimal http server failed with GO111MODULE=on go build
$ cd ~/go/src/httpd
$ cat httpd.go
package main
import "net/http"
func main() {
http.ListenAndServe(":8000", nil)
}
$ GO111MODULE=on go mod init
go: creating new go.mod: module httpd
$ GO111MODULE=on go build
# net
exec: "gcc": executable file not found in $PATH
What did you expect to see?
GO111MODULE=on go build
produces binary.
What did you see instead?
Build failed due to missing gcc
.
Either of these commands works fine though:
$ go build
$ GO111MODULE=on CGO_ENABLED=0 go build