Unrecognized command line option ‘-marm’

i have tried to cross compile go for android. but it fails with unrecognized command line option ‘-marm’

tar xvzf go1.4-bootstrap-20161024.tar.gz 
mv go go1.4
tar xvzf go1.7.4.src.tar.gz 
cd go1.4/src
cd $HOME/go/src
env GOROOT_BOOTSTRAP=$HOME/go1.4 ./make.bash
env GOOS=android GOARCH=arm GOARM=7 ./bootstrap.bash

That’s not going to do what you think it does.

What is the thing you are trying to do?

Don’t compile the go compiler and tools to android, but compile with it on the host to android:
GOARCH=arm GOARM=7 go install my/prg

This blog post might be useful


But I think you’re going about things the wrong way. As @Tamas_Gulacsi said above, cross compilation to android is probably the fastest and easiest to use ask you don’t have to install or configure anything.

Please post the exact commands you used and the full output you recieved.

My post does not mention CC_FOR_TARGET, please leave it unset.

Ok, it looks like that script does not work when bootstrapping for android. This is because of a hack put in place a few years ago which tries to pretend linux and android are the same thing (they are not).

I recommend cross compiling from your linux machine to android; don’t bootstrap, just use go build

I’m my experience people do not compile Go programs on their android devices, they cross compile them from mac or linux.

Usually they use gomobile to produce an android application that can be installed via adb push.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.