Skip to content
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

x/mobile: build error after upgrade go to 1.12 #30637

Closed
xfxdev opened this issue Mar 6, 2019 · 8 comments

Comments

Projects
None yet
5 participants
@xfxdev
Copy link

commented Mar 6, 2019

What version of Go are you using (go version)?

go1.12 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/xfx/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/xfx/Development/workspace/project/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/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/cc/l57g5px96sx4b5cnhq6bf2qh0000gn/T/go-build666588749=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

After upgrade go version to 1.12, will failed to build library for ios/android:
gomobile bind -target=ios golang.org/x/mobile/example/bind/hello

What did you expect to see?

Success

What did you see instead?

gomobile: /Users/xfx/Development/workspace/project/go/bin/gobind -lang=go,objc -outdir=/var/folders/cc/l57g5px96sx4b5cnhq6bf2qh0000gn/T/gomobile-work-547367462 -tags=ios golang.org/x/mobile/example/bind/hello failed: exit status 1
type-checking package "golang.org/x/mobile/example/bind/hello" failed (/Users/xfx/Development/workspace/project/go/src/golang.org/x/mobile/example/bind/hello/hello.go:8:8: could not import fmt (type-checking package "fmt" failed (/usr/local/opt/go/libexec/src/fmt/print.go:9:2: could not import internal/fmtsort (type-checking package "internal/fmtsort" failed (/usr/local/opt/go/libexec/src/internal/fmtsort/sort.go:12:2: could not import reflect (type-checking package "reflect" failed (/usr/local/opt/go/libexec/src/reflect/type.go:19:2: could not import runtime (type-checking package "runtime" failed (/usr/local/opt/go/libexec/src/runtime/mem_bsd.go:16:6: sysAlloc redeclared in this block)))))))))

@helperShang

This comment has been minimized.

Copy link

commented Mar 7, 2019

same error

@helperShang

This comment has been minimized.

Copy link

commented Mar 7, 2019

go get -u golang.org/x/mobile/cmd/...

build success!

@odeke-em odeke-em changed the title gomobile build error after upgrade go to 1.12 x/mobile: build error after upgrade go to 1.12 Mar 7, 2019

@gopherbot gopherbot added this to the Unreleased milestone Mar 7, 2019

@gopherbot gopherbot added the mobile label Mar 7, 2019

@odeke-em odeke-em added WaitingForInfo and removed mobile labels Mar 7, 2019

@odeke-em

This comment has been minimized.

Copy link
Member

commented Mar 7, 2019

Thank you for this report @xfxdev and welcome to the Go project! Thank you @helperShang for checking too.
@xfxdev as @helperShang posted in #30637 (comment) could you try performing the update and try again?

@xfxdev

This comment has been minimized.

Copy link
Author

commented Mar 7, 2019

Thanks @helperShang and @odeke-em, after perform the update, it's ok to build library for iOS. But still failed to build for Android:

gomobile bind -o test.aar -target=android golang.org/x/mobile/example/bind/hello
gomobile: go build -buildmode=c-shared -o=/var/folders/cc/l57g5px96sx4b5cnhq6bf2qh0000gn/T/gomobile-work-701910608/android/src/main/jniLibs/armeabi-v7a/libgojni.so gobind failed: exit status 2
# runtime/cgo
fork/exec /Users/xfx/Development/Android/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi16-clang: no such file or directory
@odeke-em

This comment has been minimized.

Copy link
Member

commented Mar 7, 2019

Alright, thanks for the update. I shall kindly page @eliasnaur

@gopherbot

This comment has been minimized.

Copy link

commented Mar 7, 2019

Change https://golang.org/cl/165937 mentions this issue: cmd/gomobile: improve NDK version detection

@eliasnaur

This comment has been minimized.

Copy link
Contributor

commented Mar 7, 2019

Gomobile requires NDK r19b but didn't detect the NDK version well enough. If you upgrade your NDK, the error should go away.

@xfxdev

This comment has been minimized.

Copy link
Author

commented Mar 7, 2019

@eliasnaur After upgrade the NDK, it works now. Thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.