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
Closed

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

xfxdev opened this issue Mar 6, 2019 · 8 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@xfxdev
Copy link

xfxdev 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
Copy link

same error

@helperShang
Copy link

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 Android, iOS, and x/mobile label Mar 7, 2019
@odeke-em odeke-em added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed mobile Android, iOS, and x/mobile labels Mar 7, 2019
@odeke-em
Copy link
Member

odeke-em 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
Copy link
Author

xfxdev 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
Copy link
Member

odeke-em commented Mar 7, 2019

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

@gopherbot
Copy link

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

@eliasnaur
Copy link
Contributor

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

@xfxdev
Copy link
Author

xfxdev commented Mar 7, 2019

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

@golang golang locked and limited conversation to collaborators Mar 6, 2020
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Look for the compiler directly, not just the existence of the
directory containing.

Fixes golang/go#30637

Change-Id: Iae4429406da8622e7085bf3701c0f84d5c95d2fd
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/165937
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Look for the compiler directly, not just the existence of the
directory containing.

Fixes golang/go#30637

Change-Id: Iae4429406da8622e7085bf3701c0f84d5c95d2fd
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/165937
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

5 participants