No errors. I wish to set some go variable using gccgoflags as I would use them with -ldflags.
I also wish more documentation as to how to set go variables when using gccgo and gccgoflags rather than go and ldflags.
What did you see instead?
github.com/go-sql-driver/mysql
gccgo: error: main.gbBuildTime=2018.04.30.102007: No such file or directory
gccgo: error: main.gbCommitHash=770fe0e: No such file or directory
gccgo: error: main.gbGitVersionTag=v1.14: No such file or directory
gccgo: error: main.gbMfwlibGitVersionTag=v1.55: No such file or directory
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’
The text was updated successfully, but these errors were encountered:
I might just be dumb, but this was the only way I was able to compile
it with gccgo (gcc-9.4, go1.12)
At least the sed fix is needed due to '-X' not being supported by gccgo
golang/go#25183
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.10
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dma2/Code/go"
GORACE=""
GOROOT="/home/dma2/Code/go/src/github.com/cloudflare/tls-tris/_dev/go1.10"
GOTOOLDIR="/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1"
GCCGO="/usr/bin/gccgo"
CC="/usr/bin/gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build074293983=/tmp/go-build -gno-record-gcc-switches"
CXX="/usr/bin/g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
This works:
go build
go build -compiler gccgo
This doesn't:
go build -compiler gccgo -gccgoflags "-X main.gbBuildTime=$(date +'%Y.%m.%d.%H%M%S') -X main.gbCommitHash=$(git log --pretty=format:'%h' -n 1) -X main.gbGitVersionTag=$(git describe) -X main.gbMfwlibGitVersionTag=$(git --git-dir ../mfwlib/.git describe)"
What did you expect to see?
No errors. I wish to set some go variable using gccgoflags as I would use them with -ldflags.
I also wish more documentation as to how to set go variables when using gccgo and gccgoflags rather than go and ldflags.
What did you see instead?
github.com/go-sql-driver/mysql
gccgo: error: main.gbBuildTime=2018.04.30.102007: No such file or directory
gccgo: error: main.gbCommitHash=770fe0e: No such file or directory
gccgo: error: main.gbGitVersionTag=v1.14: No such file or directory
gccgo: error: main.gbMfwlibGitVersionTag=v1.55: No such file or directory
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’
gccgo: error: unrecognized command line option ‘-X’
The text was updated successfully, but these errors were encountered: