x/mobile: gomobile build fails building package for arm64 if package contains cpp source code #27508
Labels
Milestone
Comments
Fixed by CL 134975. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?go version go1.11 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/tadovas/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/tadovas/work/go/openvpnv3-go-bindings"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11/libexec/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/_j/73ymsvw56v989xyfwn6q18_m0000gn/T/go-build550793449=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
Trying to build the following cpp/go gist sample
gomobile build --target=ios/arm64 cpptest
What did you expect to see?
Successfully built package
What did you see instead?
gomobile: go build -tags ios cpptest failed: exit status 2
ld: warning: ignoring file $WORK/b001/_x003.o, file was built for x86_64 which is not the architecture being linked (arm64): $WORK/b001/_x003.o
Undefined symbols for architecture arm64:
"_hello", referenced from:
__cgo_f57df320d1c2_Cfunc_hello in _x002.o
(maybe you meant: __cgo_f57df320d1c2_Cfunc_hello)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The problem seems to be here:
as CGO_CFLAGS are set up, but no CGO_CXXFLAGS are defined. The possible workaround would be to call CGO_CXXFLAGS='-arch arm64' gomobile ... but it looks a bit cumbersome.
The text was updated successfully, but these errors were encountered: