Ask questionscmd/link: showing many ld warnings of "building for macOS, but linking in object file"
<!-- Please answer these questions before submitting your issue. Thanks! -->
<pre> $ go version go1.12.7 darwin/amd64 </pre>
Mac Mojave 10.14.5
GOARCH="amd64" GOBIN="" GOCACHE="/Users/avence12/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/avence12/.gvm/pkgsets/go1.12.7/global:/Users/avence12/devel/go" GOPROXY="" GORACE="" GOROOT="/Users/avence12/.gvm/gos/go1.12.7" GOTMPDIR="" GOTOOLDIR="/Users/avence12/.gvm/gos/go1.12.7/pkg/tool/darwin_amd64" GCCGO="gccgo" CC="clang" CXX="clang++" 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=/var/folders/9n/_tfc4bt12ps45qjyzh40jt1h0000gn/T/go-build525129295=/tmp/go-build -gno-record-gcc-switches -fno-common"
go build ./...
go test ./...
export CGO_ENABLED=0, the warning is gone. However I would like to know how to resolve the issue.
No ld warnings when
$ go build ./cmd/... # github.com/avence12/myproj/cmd/client ld: warning: building for macOS, but linking in object file (/var/folders/9n/_tfc4bt12ps45qjyzh40jt1h0000gn/T/go-link-703159202/go.o) built for # github.com/avence12/myproj/cmd/server ld: warning: building for macOS, but linking in object file (/var/folders/9n/_tfc4bt12ps45qjyzh40jt1h0000gn/T/go-link-846047020/go.o) built for
Answer questions thanm
I tried looking at the Apple sources for the linker, but unfortunately they don't seem to have released source code for this version of the linker. The closest I could find was version 409; in that source base there is a somewhat similar error message here at line 2181 but I don't think this is the scenario: from looking at the code that only triggers when using bitcode, and if it does trigger it's a fatal error and not a warning. Too bad we don't have up-to-date source to look at.