Skip to content

GOOS=android GOARCH=arm doesn't compile on amd64 #17736

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

Closed
erlanger opened this issue Nov 2, 2016 · 1 comment
Closed

GOOS=android GOARCH=arm doesn't compile on amd64 #17736

erlanger opened this issue Nov 2, 2016 · 1 comment

Comments

@erlanger
Copy link

erlanger commented Nov 2, 2016

Please answer these questions before submitting your issue. Thanks!

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

go version go1.7.3 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/gocode"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build431324223=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

Just compile a simple program:

package main
import "fmt"
func main() {
   fmt.Printf("Hello")
}
$ env GOOS=android GOARCH=arm go build -o g1 g.go
# command-line-arguments
warning: unable to find runtime/cgo.a
/usr/lib/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
gcc: error: unrecognized command line option ‘-marm’; did you mean ‘-mabm’?

What did you expect to see?

The same as if I change GOOS to linux

$ env GOOS=linux GOARCH=arm go build -o g1 g.go
$

What did you see instead?

See error above.

@ianlancetaylor
Copy link
Contributor

In order to cross-compile for Android, you need to set the CC environment variable to a C cross-compiler.

For details on building for Android, please use a forum. See https://golang.org/wiki/Questions.

@golang golang locked and limited conversation to collaborators Nov 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants