Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Golang. Cross Compiling for MIPS

I have tried compiling my simply program:

func main(){fmt.Printf("Hello")}

to MIPS architecture on my PC wit 64 bit Debian Linux according to documentation

https://golang.org/doc/install/source#environment

via using command

GOOS=linux GOARCH=mipsle go build 
GOOS=linux GOARCH=mips go build

Every time I get the error:

runtime/internal/sys compile

unknown architecture "mipsle(mips)"

The interesting thing is, if a try using command:

GOOS=linux GOARCH=mipsle64 go build

The program was build.

Is it dependent on system OS on my PC ? How can I build a binary for MIPS or MIPSLE ?

like image 696
Mbded Avatar asked Oct 21 '25 14:10

Mbded


1 Answers

Go 1.6 does not support MIPS or MIPSLE. 1.6 supports MIPS64(LE). 1.8 supports MIPS(LE).

From https://golang.org/doc/install/source:

  • amd64 (also known as x86-64)
    • A mature implementation.
  • 386 (x86 or x86-32)
    • Comparable to the amd64 port.
  • arm (ARM)
    • Supports Linux, FreeBSD, NetBSD, OpenBSD and Darwin binaries. Less widely used than the other ports.
  • arm64 (AArch64)
    • Supports Linux and Darwin binaries. New in 1.5 and not as well exercised as other ports.
  • ppc64, ppc64le (64-bit PowerPC big- and little-endian)
    • Supports Linux binaries. New in 1.5 and not as well exercised as other ports.
  • mips, mipsle (32-bit MIPS big- and little-endian)
    • Supports Linux binaries. New in 1.8 and not as well exercised as other ports.
  • mips64, mips64le (64-bit MIPS big- and little-endian)
    • Supports Linux binaries. New in 1.6 and not as well exercised as other ports.
  • s390x (IBM System z)
    • Supports Linux binaries. New in 1.7 and not as well exercised as other ports.
like image 177
Ethan Reesor Avatar answered Oct 23 '25 09:10

Ethan Reesor