golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
120.43k stars 17.29k forks source link

x/mobile/cmd/gomobile: build fails with SDK 34 #67496

Closed hajimehoshi closed 1 week ago

hajimehoshi commented 2 weeks ago

Go version

go version go1.22.3 darwin/arm64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/hajimehoshi/Library/Caches/go-build'
GOENV='/Users/hajimehoshi/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/hajimehoshi/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/hajimehoshi/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.22.3'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/hajimehoshi/go-x-mobile/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/cj/73zbb35j0qx5t4b6rnqq0__h0000gn/T/go-build3108044952=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

  1. Prepare Android SDK 34. (If there are older versions, this bug might not be reproduced.)
  2. Install gomobile (a1a533f289d32c6297d63bfdc30e42c80b5a1f55)
  3. Run gomobile build -androidapi=34 ./example/basic at the gomobile directory

For 1, I installed Android SDK 34 or newer only:

image

What did you see happen?

Error:

gomobile: go build -buildmode=c-shared -o /var/folders/cj/73zbb35j0qx5t4b6rnqq0__h0000gn/T/gomobile-work-3204247024/lib/armeabi-v7a/libbasic.so golang.org/x/mobile/example/basic failed: exit status 1
# golang.org/x/mobile/app
app/android.go:368:6: could not determine kind of name for C.ALooper_pollAll

What did you expect to see?

The build succeeds.

The related issues are:

hajimehoshi commented 2 weeks ago

https://developer.android.com/ndk/reference/group/looper#alooper_pollall

ALooper_pollAll should be replaced with ALooper_pollOnce.

gopherbot commented 2 weeks ago

Change https://go.dev/cl/586595 mentions this issue: all: replaced ALooper_pollAll with ALooper_pollOnce