-
Notifications
You must be signed in to change notification settings - Fork 18k
x/vgo: build defaults to clang, but go build uses gcc #23965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I can't use vgo to compile code that uses the net package unless I use |
@rogpeppe As a temporary workaround, have you tried something like |
@ngrilly Good point! That worked, thanks. |
both But I'm still in doubt. Is this a bug (given that the behavior is different from actual |
I expect this is an oversight - Afaik, using |
golang.org/x/vgo/vendor/cmd/go/internal/cfg/cfg.go has an objabi function that reads various defaults out of the Go tree source code. There should be a similar function for initializing the default CC settings. (We're avoiding invoking the go command so that there are no problems if someone installs a fake "go" command that invokes vgo.) |
Change https://golang.org/cl/109975 mentions this issue: |
sorry to comment such an old issue, but with the commit the fix from here (https://go-review.googlesource.com/c/vgo/+/109975/4/vendor/cmd/go/internal/cfg/zdefaultcc.go) seems to be reverted: golang/vgo@2093985#diff-983ae2c32b0c34dc25b2df4c51b25940 --> i now get the same error as this ticket describes.
|
What version of Go are you using (
go version
)?go version go1.10 linux/amd64 vgo:2018-02-20.1
What operating system and processor architecture are you using (
go env
)?$ vgo env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mark/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mark/Prog/golang"
GORACE=""
GOROOT="/home/mark/go1.10"
GOTMPDIR=""
GOTOOLDIR="/home/mark/go1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build793572054=/tmp/go-build -gno-record-gcc-switches"
VGOMODROOT=""
Differences from go1.10 to vgo:
$ diff -U0 <(go env) <(vgo env)
--- /dev/fd/63 2018-02-21 09:41:31.642358384 +1100
+++ /dev/fd/62 2018-02-21 09:41:31.642358384 +1100
@@ -14,2 +14,2 @@
-CC="gcc"
-CXX="g++"
+CC="clang"
+CXX="clang++"
@@ -23 +23,2 @@
-GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build308581873=/tmp/go-build -gno-record-gcc-switches"
+GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build660393002=/tmp/go-build -gno-record-gcc-switches"
+VGOMODROOT=""
What did you do?
vgo build with a dependency on CGO:
What did you expect to see?
vgo should use the same compiler as go.
zdefaultcc.go as shipped by go1.10 linux/amd64 uses gcc/g++.
Separately, perhaps zdefaultcc.go should use cc/c++ instead? It is generally available and could be clang or gcc.
The text was updated successfully, but these errors were encountered: