go: x/mobile: gomobile bind is failing with latest version [+cafc553] of gomobile
What version of Go are you using (go version)?
$ go version: go1.12.4 linux/amd64 $ go mobile version: gomobile version +cafc553 Mon Aug 26 17:01:11 2019 +0000 (android); androidSDK=/home/--/Android/Sdk/platforms/android-28
Does this issue reproduce with the latest release?
Yes, the issue is produced only on the latest gomobile version.
What operating system and processor architecture are you using (go env)?
go env Output
$ go envGOARCH=“amd64” GOBIN=“/usr/local/go” GOCACHE=“/home/–/.cache/go-build” GOEXE=“” GOFLAGS=“” GOHOSTARCH=“amd64” GOHOSTOS=“linux” GOOS=“linux” GOPATH=“My Go path” GOPROXY=“” GORACE=“” GOROOT=“/usr/local/go” GOTMPDIR=“” GOTOOLDIR=“/usr/local/go/pkg/tool/linux_amd64” GCCGO=“gccgo” CC=“gcc” CXX=“g++” 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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build242944229=/tmp/go-build -gno-record-gcc-switches”
What did you do?
Trying to generate the java binding for my go file: Error:
gomobile bind -o ~/test.aar -target=android -androidapi=23 test || exit 1 gomobile: $GOPATH/bin/gobind -lang=go,java -outdir=/tmp/gomobile-work-628614164 test failed: exit status 1 2019/08/27 09:51:37 go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags – test]: exit status 2: # runtime/cgo gcc_android.c:6:25: fatal error: android/log.h: No such file or directory compilation terminated.
What did you see instead?
Error in generating the java binding.
Note: Before updating the gomobile same code was building.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 35 (14 by maintainers)
I am getting this problem gcc_android.c:6:10: fatal error: ‘android/log.h’ file not found and from the above am not clear what I have to do to fix it gomobile version +d9e324c Sat Nov 23 05:49:42 2019 +0000 (android); androidSDK=/Users/davidsteed/Library/Android/sdk/platforms/android-28
Just to confirm:
I then removed
strings.Count(stderr.String(), "\n") == 2from/home/rkaufmann/go/src/golang.org/x/tools/go/packagesand everything seem to work afterwardsIt is safe to give
GO111MODULE=offexplicitly when go-getting gomobile/gobind. My guess is that you did go-get with modules. Then try:EDIT: module-aware go-get also installs binaries under $GOPATH/bin, so
golang.org/x/mobile/cmd/gobindshould work. 🤔Could you try gomobile with
GO111MODULE=off?