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: gomobile bind does not work with cgo and android #35426
Comments
Specifically inner gobind command fails to run gobind with these environment variables GOOS=android CGO_ENABLED=1 gobind -lang=go,java -outdir=./build/bind $GOPATH/mobile/test I installed go std library for cgo with TOOLCHAIN=/usr/local/android-ndk-r20/toolchains/llvm/prebuilt/linux-x86_64
ARCH=armv7a
export AR=$TOOLCHAIN/bin/$ARCH-linux-android-ar
export AS=$TOOLCHAIN/bin/$ARCH-linux-android-as
export CC=$TOOLCHAIN/bin/$ARCH-linux-androideabi28-clang
export CXX=$TOOLCHAIN/bin/$ARCH-linux-androideabi28-clang++
export LD=$TOOLCHAIN/bin/$ARCH-linux-android-ld
export RANLIB=$TOOLCHAIN/bin/$ARCH-linux-android-ranlib
export STRIP=$TOOLCHAIN/bin/$ARCH-linux-android-strip
GOOS=android GOARCH=arm CGO_ENABLED=1 go install std It would be awesome if some of you @steeve @hyangah could check if gomobile + latest android ndk + clang + cgo works for you. |
I found the problem. My command was missing GOARCH env variable. Full command should be GOOS=android GOARCH=arm CGO_ENABLED=1 gomobile bind ... |
One thing I don't like is that I get this error /CC @bcmills |
My build environment has encountered the same problem, and trying to change the any version of Go can't be solved. |
Me too, anyone can help me ? |
me too. have you solve it yet? |
Don't forget to set |
I set CGO_ENABLED=1 and still get this error. |
i use an older version of gomobile and it works ok with cgo |
@bbadbeef which version did you use? |
92f3b9c works ok, the newer versions are not finally i found it's not ok, just not output error message when compiling |
|
Guys for you information for android I've start using this docker images which works fine: openpriv/android-go-mobile at the moment is updated at 10 Jul 2018. |
my go function have c type param and return value, can it be supported with gomobile? |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I have this simple test package with cgo and I'm building it for android with android-ndk-r20.
Build:
What did you expect to see?
No error. Note that:
What did you see instead?
Error:
The text was updated successfully, but these errors were encountered: