Skip to content

x/mobile: gomobile binding failed due to lack of some header file in Android NDK #39549

@ChronosXYZ

Description

@ChronosXYZ

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

$ go version
go version go1.14.4 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/chronosx/.cache/go-build"
GOENV="/home/chronosx/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/chronosx/Документы/code/golang/"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/5830"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/5830/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
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-build278490309=/tmp/go-build -gno-record-gcc-switches"

Android NDK version: 21.3.6528147

Gomobile version: gomobile version +4c31acb Sun Mar 29 12:56:38 2020 +0000 (android); androidSDK=

(I'm tried to use Go from Ubuntu repos, not only from Snap)

What did you do?

I'm trying to build some library which written in Go for Android (build AAR file).

gomobile: go build -tags mobile -ldflags -X github.com/yggdrasil-network/yggdrasil-go/src/version.buildName=yggdrasil -X github.com/yggdrasil-network/yggdrasil-go/src/version.buildVersion=0.3.14 -s -w  -buildmode=c-shared -o=/tmp/gomobile-work-131080533/android/src/main/jniLibs/armeabi-v7a/libgojni.so ./gobind failed: exit status 2
# runtime/cgo
gcc_android.c:6:10: fatal error: 'android/log.h' file not found

The file android/log.h exists in Android NDK.

What did you expect to see?

Library will compile successfully (it was compiled fine before).

What did you see instead?

I got the error:

gcc_android.c:6:10: fatal error: 'android/log.h' file not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.mobileAndroid, iOS, and x/mobile

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions